okay i have a list of random images and urls right now. it's huge so I put it's source at:
http://kafene.org/randimgsrc.txt
I want to do this:
keep the array for the random images.
Change the if/else business to a corresponding array so that they match up
generate a list of all these images (so that rather than being random, they all just dump into the form <a href="$url"><img src="$img" alt="img" />
OR what I think is easier AND better:
take the contents of an entire directory, make the images named like imagename.com.png and then randomly get one, put it in the form <a href="http://www. $imagename - .png"><img src="$imagename" alt="img" /></a>...
If you can just give an example for either I should be able to work from there.
EDIT:
the directory listing I would want in that format is http://kafene.org/img/ .
i realize i would have to change the filenames.
random... list... mess.
Moderator: General Moderators
-
Daisy Cutter
- Forum Commoner
- Posts: 75
- Joined: Sun Aug 01, 2004 9:51 am
ok i've been thinking about this...
for the second one where I got a plain directory listing and used it almost like a flat file database:
I could use a for loop and this code:
and then use something like sed (but in PHP) to search for and output results...
for the second one where I got a plain directory listing and used it almost like a flat file database:
I could use a for loop and this code:
Code: Select all
<?php
if ($handle = opendir('/home/mcovey/kafene.org/img')) {
echo "Directory handle: $handle\n";
echo "Files:\n";
while (false !== ($file = readdir($handle))) {
echo "$file\n";
}
closedir($handle);
}
?>-
Daisy Cutter
- Forum Commoner
- Posts: 75
- Joined: Sun Aug 01, 2004 9:51 am