0

I want to use flexslider on my site, grabbing the images from a folder without having to list each and every file name in the folder (100+ images).

Is there some php script i can use to create something like an echo script that will make an " list?

Any suggestions would be much appreciated Thanks

2 Answers2

0

You can make a php loop script.... For that you should have a DB table with the files path listed.

then you run the script while $sqlarray = mysql_fetch_array($sql)

malaquias
  • 65
  • 1
  • 1
  • 9
0

It's possible to create a PHP script that will look in a given folder and loop through all the files in that folder, outputting specific code for each.

<?php
$path = "/path/to/files";

if ($handle = opendir($path)) {
    echo "<ul>";

    while (false !== ($file = readdir($handle))) {
        if ('.' === $file) continue;
        if ('..' === $file) continue;

        echo "<li>".$file."</li>";
    }
    echo "<ul>";
    closedir($handle);
}
?>

It'll need tweaking to do exactly what you need but this can get you started.

See: PHP script to loop through all of the files in a directory?

Community
  • 1
  • 1
MadTurki
  • 343
  • 1
  • 6
  • 18