开发者

Joomla folder listing problem

I'm working on a Joomla component which involves files manipulation. For this purpose, I tried to list all folders in the "images" folder (which consists all of images used in the website). So here's my simple code to test this:

<?php
   foreach (JFolder::folders('images') as $folder){
        echo $folder."\n";
   }
 ?>

However, it returns an empty array. This is not the case if I use JFolder::files; it will list all files in the said folder. So is there any way for me to retrieve the folders list? Or is there somet开发者_高级运维hing wrong with the system etc etc?

As usual, let me know if I have to add anything as clarification. Thanks for your help!

SOLVED: Instead of JFolder::folders('images'), I changed it to JFolder::folders(JPATH_ROOT.'/images'). Maybe it's missing the actual path to the folder.


Sounds like you're after:

$tree = JFolder::listFolderTree('images');

See reference here: http://api.joomla.org/Joomla-Framework/FileSystem/JFolder.html#listFolderTree

Failing that I would suggest checking the permissions of your directories are that of your files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜