Filenames to variables [solved]
Posted: Tue Jul 19, 2005 11:00 pm
I have an image gallery on my site that I'd like to setup to be a little more dynamic. I'd like to reference my pictures using <?=$pic1?> through <?=$pic24?> how could I dynamincally create these variables based on the files in a folder? So it picks the latest 24, or even the first 24 alphabetically.
Here's an example of how I'm using it:
PHP(This being the part that would change to allow for dynamic naming):
JS:
HTML:
Thanks!
Here's an example of how I'm using it:
PHP(This being the part that would change to allow for dynamic naming):
Code: Select all
<?php
$pic1 = filename;// through pic24...
?>Code: Select all
var <?=$pic1?> = new Image();
<?=$pic1?>.src = "e;http://www.dustinyonak.net/images/<?=$pic1?>.jpg"e;;Code: Select all
<a href = "e;http://www.dustinyonak.net/http://www.dustinyonak.net/images/<?=$pic1?>.jpg"e; onmouseover = "e;doButtons('<?=$pic1?>')"e;><img src="e;http://www.dustinyonak.net/images/<?=$pic1?>.jpg"e; height="e;60"e; width="e;80"e; border=0></a>