php - get images from directory and ad to ul -


i'm using responsive pattern brad frost's library create image grid (beta version here: http://yogeshsimpson.com/fry). want have 3 folders of images 3 portfolio categories client can drop images into.

from there think php right tool images folder, wrap in li , tags , have them added ul. on homepage see images 3 directories, , on "lighting" page example, see images directory, etc.

again i'm assuming easy php, it's bit beyond grasp. appreciated. thanks.

something work, run within folder wish list files.

<?php  if ($handle = opendir('.')) {    while (false !== ($file = readdir($handle)))       {           if ($file != "." && $file != "..")       {              $thelist .= '<li><a href="'.$file.'">'.$file.'</a>' . "<br>";            }        }   closedir($handle);   }        ?> <p>list of files:</p> <p><?=$thelist?></p> 

or:

<?php  // if running root , wish list files 'images' sub-folder // use $dir = 'images'; $dir = '.'; // directory containing files.  // *.* list files. can use *.jpg list jpg files, etc. $ext = '*.*'; // list files ?>   <ul> <?php foreach (glob($dir . '/*' . $ext) $file) { ?>  <li><a href="<?php echo $dir . "/" . $file ?>"><?php echo basename($file); ?></a></li>  <?php } ?> </ul> 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -