This example demonstrates the use of the method when used recursively:
$folder = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_poll';
$folders = JFolder::folders($folder, '.', true);
Utilities and Useful Classes
[ 350 ]
The resultant array will look like this:
Array
(
[0] => elements
[3] => poll
[1] => tables
[2] => views
)
The main problem with this method is that there are no indications as to which
folders are direct descendants. We can use the final parameter to over come this.
The final parameter is a Boolean value that determines if the returned array is a list
of folder names or a list of folder paths. This example demonstrates the use of the
method when used to get the full paths of the folders:
$folder = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_poll';
$folders = JFolder::folders($folder, '.', true);
The resultant array will look like this:
Array
(
[0] => /joomla/administrator/components/com_poll/elements
[1] => /joomla/administrator/components/com_poll/tables
[2] => /joomla/administrator/components/com_poll/views
[3] => /joomla/administrator/components/com_poll/views/poll
)
The files() method is used to list the files within a folder.
Pages:
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487