0
need to display all images within a folder
i have a website and need to be able to display all images within a folder using html, javascript, and jquery and i need it to be able to have my css file style it: http://vortetty.k3live.com/mainstyle.css the images will all need to use the ID "center" to position them, if i need to use php, i can but my server is a little finicky with that
3 Réponses
+ 1
you will have to use php or some other server side script. Javascript runs on the client computer and can't access the directory structure on your server.
first in your css there is no #center style defined. also, when using id vs class keep in mind you can only use an id once per page. they are supposed to be unique. If you have more than one instance of something use class.
<?php
$handle = opendir('/path/to/folder');
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo '<ing src="/path/to/folder/'.$entry.'" class="center" />';
}
}
?>
0
Thank you for the code, my server most likely did not receive the update for center tag.
0
My question is how do I use classes to assign css, not good at either