Jump to content

open files in folders dynamics


paolibo

Recommended Posts

hello, I have implemented a snippet that reads images in

I create folders dynamically from admin and makes them see

lightbox style .. the same works fine but it shows all

images in all folders and not those relating to

folder clicked ..

The result you can see it here:

aires-restauro.org/beta/gallery2.php

 

code:

<?php

$folder = opendir('gallery/');

echo "<gallery>";

while ($file = readdir($folder)) {

if($file != '.' && $file != '..'){

echo "<album path='gallery/$file/' name='$file'>";

$subfolder="gallery/".$file."/";

$subfolderdir = opendir($subfolder);

while ($subfile = readdir($subfolderdir)) {

if($subfile != '.' && $subfile != '..'){

echo "<a href='$subfolder$subfile' class='pirobox_gall'>$file</a>";

}

}

echo "</album>";

}

}

echo "</gallery>";

?>

 

 

repeats the same directory as I would like to see that by clicking the directory do see the images of that directory

 

sorry but I do not speak English well and I thank you in advance

Link to comment
https://forums.phpfreaks.com/topic/227776-open-files-in-folders-dynamics/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.