Version: 1.0

Type: Full Script

Category: HTML

License: GNU General Public License

Description: A simple php page that makes adding LONGDESC pages for images much easer. Can also be used for 'd' links for images. It's extreamly simple code, took like ten minutes to write, but I thought it might be of use to someone else. Based in part on the LONGDESC page at CAST: Center for Applied Special Technology [http://cast.org/].



<?php
	// use a seperate 'case' block for each image description id
	switch($HTTP_GET_VARS['img']) {
		// For an example, this is the image long description used for the 'Bobby' button at the CAST website.
		case 'bobby' : // CAST bobby icon
			$title = 'Bobby Approved (v 3.2)';
			$desc = 'Bobby Approved Symbol. A friendly uniformed police officer wearing a helmet displaying the wheelchair access symbol. Words &quot;Bobby Approved&quot; appear to his right. Links to &quot;http://www.cast.org/bobby&quot;.';
			break;
		case 'example' : // An example image
			$title = 'Just an example image';
			$desc = 'This is just an example image longdesc entry.';
			break;
		// edit to point to your own email address.
		// you might want to change the text of this if you are female.
		default : // oops
			$title = 'Missing Long Description';
			$desc = 'I\'m sorry, it appears that the webmaster has forgotten to add the description for this image.  Please feel free to <A HREF="mailto:you@yourpage.com">email him</A> and ask him to fix this.  Thank you.';
			break;
	}
	/*
	 * Here's an example of how you could use this.  In your regular
	 * webpages, PHP or not, simply add a link to this in the LONGDESC
	 * attribute of your image.
	 *
	 * <IMG SRC="example.gif" ALT="An example image" LONGDESC="longdesc.php?img=example">
	 *
	 * If you wish to use a 'd' link with this (to support older browser software) you can do this.
	 *
	 * <IMG SRC="example.gif" ALT="An example image" LONGDESC="longdesc.php?img=example"><BR>
	 * <A HREF="longdesc.php?img=example" TITLE="d link">d</A>
	 *
	 * The HTML code below can be modified to fit the look and feel of your website.
	 */
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
	<HEAD>
		<TITLE>Image Description for <?php print $title; ?></TITLE>
	</HEAD>
	<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000cc" VLINK="#cc0000" ALINK="#ff00ff">
		<H2>Image: <?php print $title; ?></H2>
		<P>
			<B>Description:</B>
			<?php print $desc; ?>
		</P>
<?php
	if($HTTP_SERVER_VARS['HTTP_REFERER']) :
?>
		<P>
			Return to <A HREF="<?php print $HTTP_SERVER_VARS['HTTP_REFERER']; ?>" ALT="Returns you to the page you were just at.">the previous page</A>.
		</P>
<?php
	endif;
?>
	</BODY>
</HTML>