PDA

View Full Version : Pretty big site, and a few nice code snippets



jofish
02-03-2003, 12:40 PM
I've got about a 3500 photos and a handful of videos and the like up at

http://photos.jofish.com

The bit I'm most pleased with is the comment.txt file: I've written a handler that looks for a comment.txt file in the same directory as the images, and if it exists puts the content of that into the webpage, and puts a standard message otherwise. For example, on the page http://marketa.jofish.com the lines




Friday, 13th September 2002

Indy & Marketa got married in a "civil" ceremony in Providence, Rhode Island.
These are the 'edited highlights' photos; the full set, complete with videos, is here.



are in my comment.txt file, complete with html formatting and links. (I guess .txt isn't the right extension. But whatever.)

The code snippet (cut from the html template, but you should be able to figure it out)

&if (Eql("Unable", Left(Import(Join(path(thmPage), "\\comment.txt")),6)), "All images copyright (C) Joseph Kaye 1995-2003.", T(Import(Join(path(thmPage), "\\comment.txt"))))

Chris has suggested I use ifExist (I think it was), rather than looking for the left six chars of the error message ("Unable to load file") when the file isn't there, because the error message might change in the future. This is probably right. But in the spirit of if it ain't broke, don't fix it, until he changes the error message just to teach me I'm probably not going to get around to fixing it...