Location: PHPKode > scripts > DirContent > dircontent/examples/demo.php
<?php
/**
 * Example script.
 */
include_once('SomeDir.php');

$someDir = new SomeDir();
//You can also directly instantiate DirContent class, without 
//need to previously extend it, for example: 
//$someDir = new DirContent('/path/to/someDir');

echo '<pre>';
print_r($someDir->getContent());
echo '</pre>';

echo '<pre>';
print_r($someDir->getContent('name')); //Getting content sorted by name.
echo '</pre>';

echo '<pre>';
print_r($someDir->getContent(null, false)); //Getting content with default sorting and without retrieving subdirs.
echo '</pre>';

echo '<pre>';
print_r($someDir->getContent(array('type'=>DirContent_Sort::ORDER_DESC), true, array('img'))); //Getting content that will be sorted by type (descending order), with subdirs content included, but omitting dir with name 'img'.
echo '</pre>';
?>
Return current item: DirContent