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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.