Support Joomla!

references:joomla.framework:filesystem:jfolder-folders

Table of Contents

folders

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage FileSystem Class JFolder Method folders Reference folders() Never Work in Progress

Utility function to read the folders in a folder. This function uses FTP if enabled, otherwise, it will use the built in PHP functions. An array containing the folders in the folder is returned.

Syntax

array folders ( $path, $filter, $recurse, $fullpath )

$path string is a string containing the path of the folder to read.
$filter string is a string containing a filter for folder names. The filter is applied as a regular expression, so this syntax should be followed. This parameter is optional and if omitted defaults to an empty string.
$recurse boolean is a flag which specifies whether or not sub-folders should be recursively searched. This parameter is optional and if omitted defaults to false.
$fullpath boolean is a flag which specifies whether or not the full path to the folder should be returned. This parameter is optional and if omitted defaults to false.
$exclude array is an array of strings containing folders that should be excluded from the result. This parameter is optional and if omitted defaults to an array containing the entries ‘.svn’ and ‘CVS‘, which will result in SVN and CVS folders being filtered out.

Examples

Example

jimport( 'joomla.filesystem.folder' );
$folders = JFolder::folders( 'plugins/', '.*', false, true );
print_r( $folders );

might produce:

Result

Array
(
    [0] => plugins\authentication
    [1] => plugins\content
    [2] => plugins\editors
    [3] => plugins\editors-xtd
    [4] => plugins\search
    [5] => plugins\syndicate
    [6] => plugins\system
    [7] => plugins\user
    [8] => plugins\xmlrpc
)

Discussion

Full name:
E-Mail:
 
references/joomla.framework/filesystem/jfolder-folders.txt (590 views) · Last modified: 2007/08/15 15:06