I took the following script and adapted to my needs but have one problem. I don’t want the files to show in that directory. I only want to see the folders. I’m using this for a menu that is folder driven so it’s easy for my client to just upload a folder of images and the menu updates. Any help.
This outputs:
Folder - Subfolder
Folder - Images *when no subfolder is available
Folder -Subfolder
Folder - Images *when no subfolder is available
I would like not in this order but depending on the folder structure as exampleDon’t:
Folder - Subfolder
Folder - *No subfolder, no images displayed
Folder - Subfolder
Folder - Subfolder
Folder - *No subfolder, no images displayed
ok, so I tried the above suggestion and I can’t get ANY directory to show after the first layer. I have tried to set the $dir2 to the absolute path and still nothing. Any more suggestions or what am I missing?
Safe Mode = Off
open_basedir = no value
ok so after more playing around I’m more confused.
is_dir() doesn’t see any folders except “.” and “…” but when I make them not available I can’t see any folders.
What am I doing wrong that it won’t see any folders in the directory tree?
ps. From php’s manual: “filename: Path to the file. If filename is a relative filename, it will be checked relative to the current working directory. If filename is a symbolic or hard link then the link will be resolved and checked.”
That worked perfect except a small { issue towards the bottom to close up the first if statement. Thank you very much.
I do however have one question about making this work even better. it’s probably not possible with the setup but is there anyways that if the folder doesn’t have a subfolder inside that it doesn’t insert the <ul> right off the bat?
The problem I am having, not really a problem but it’s kind of annoying with the menu is because there is a . and … in the folder the dir2 returns true everytime till it gets to the statement about excluding the . and …
I tried just moving the <ul> inside that statement but it just messes everything up.
example from the source code.
<ul>
<li><a href="#">Living Room</a>
<ul></ul> //Here is an empty tag and it makes the menu think that it has to add a plus sign because it's there.
The folder only has images in it, not another directory
</li>
<li><a href="#">Studies</a>
<ul>
<li><a href="#">Red</a></li>
<li><a href="#">Wooden</a></li>
</ul>
Other than that small annoyance this script was perfect and I am very grateful for your assistance! Thank You again!