Wednesday, August 03, 2005

Help, Oh Smart Peoples!

I need a bit of web programming assistance.

I run a web site for my family, pictures and news and whatnot. It's very very basic, I'm one of those losers using FrontPage.

There is a functionality that I want to add, but I can't figure it out.

I currently have captions under the pictures: "This is Mike at the Bolivian prison where he got his first tattoo." you know the kind.

Right now, the caption text is a part of the photo page itself. So if I want to change the caption text, I open the page's HTML and type the caption into the code for that page.

What I would like to do is have the caption be more dynamic, with the source text coming from another file and folder.

I change the layout of the picture pages from time to time, and then I just drop the new template in and apply it to all the pic folders. I like this setup.

But when I drop in the new templates, I lose my captioning. This is why I want to have the captions summoned from a separate file, just like the jpgs are.

Like so:

Folder - Pic Pages
Pic_Page1.htm
Pic_Page2.htm
etc

Folder - Pics
Pic1.jpg
Pic2.jpg
etc

Folder - Captions
Caption1.txt
Caption2.txt
etc.

Usually I can hunt around with Google until I find the info I need to do something in HTML, but this time no luck. If you folks could point me in the right direction, I would be grateful!

Even a "search for 'dynamic text' in java, Mike you goober" would be nice.

Of course, I could use Blogger of Flickr, but I don't wanna.

Any ideas?

2 comments:

  1. You could accomplish this with server side programming. Nothing too complicated, but definitely a step away from the friendly waters of FrontPage. Languages like perl (or java) are ideal because they generate the web page on demand, dynamically, and in doing so you can have them open and read flat files to get the content you want to display. So the script would look like this:

    print '(all html header stuff)';
    open file;
    read bits you need;
    print '(bits you need with html wrapped around them)';
    close file;
    print '(all html footer stuff);

    (The output of all of the print statements ends up being your web page.)

    Perl is pretty easy. I'm sure you could query on 'perl scripts that read text files' or something like that to get an example. But you'll want to find out if your web server can run perl first.

    ReplyDelete
  2. Wow, great help, Mr. Lizard! You even provided a code example!

    Many thanks!

    ReplyDelete