$_SERVER['DOCUMENT_ROOT'] . '../cms/', 'regFunction' => 'preg_match', 'regEx' => '/^.*\.block\.php$/', //'sort' => TRUE, 'returnType' => 'nested', 'fileDirLink' => array('dir'=>TRUE, 'dirlink'=>FALSE), ); $dir =& new Bs_Dir(); $pageList = $dir->getFileList($options); function makeA($arr, $prefix='/') { $a = array(); foreach ($arr as $key => $subArr) { $t = array(); $t['caption'] = $key; //$t['url'] = 'myPage.php?page=' . $prefix . $key; //$t['target'] = '_blank'; if (is_array($subArr) && !empty($subArr)) { $t['children'] = makeA($subArr, $prefix . $key . '/'); if (!is_array($t['children']) || empty($t['children'])) unset($t['children']); } $a[] = $t; } return $a; } $a = makeA($pageList); ?>