jmd ne idee wie ich irgendwie auf das "type" verzichten kann?
if (is_array($subfolder[0]) || $subfolder['type'] == "folder" ){
[script]
Array
(
[0] => Array
(
[label] => obst
[type] => folder
[1] => Array
(
[start] =>
[label] => banane
[link] => banane.html
)
[0] => Array
(
[start] => 1
[type] => page
[label] => apfel
[link] => apfel.html
)
[2] => Array
(
[start] => 1
[type] => folder
[label] => kiwis
[0] => Array
(
[start] => 1
[type] => page
[label] => große
[link] => große.html
)
[1] => Array
(
[start] =>
[type] => page
[label] => kleine
[link] => kleine.html
)
)
)
[1] => Array
(
[label] => gemüse
[type] => folder
[0] => Array
(
[start] => 1
[type] => page
[label] => kartoffel
[link] => kartoffel.html
)
)
[2] => Array
(
[label] => fleisch
[type] => folder
)
)
[/script]
if (is_array($subfolder[0]) || $subfolder['type'] == "folder" ){
PHP-Code:
private function _showFolder($folder) {
$tmp = "";
if(($this->_depth < $this->maxDepth) or ($this->maxDepth == "0")) {
// new layer?
if (is_array($folder)) {
// loop array
$layer = "";
foreach($folder as $key => $subfolder) {
// folder, evtl kann irgendwie auf den type verzichtet werden?
if (is_array($subfolder[0]) || $subfolder['type'] == "folder" ){
// increase depth
$this->_depth ++;
// Unterordner Rekursiv anzeigen
$subsub = "\n".$this->_showFolder($subfolder);
// active foldeR?
if(in_array($subfolder['label'], $this->_invPathArray) && $this->activePath) {
$tmp_folder .= str_replace('{$folder}', $subsub, str_replace('{$label}', "Folder: ".$subfolder['label'], $this->navTpl['folderactive']));
} else {
$tmp_folder = str_replace('{$folder}', $subsub, str_replace('{$label}', "Folder: ".$subfolder['label'], $this->navTpl['folder']));
}
// link der startseite
$tmp_folder = str_replace('{$link}', $this->_getStartPageUrl($subfolder), $tmp_folder);
$layer .= $tmp_folder;
// _page?
} else {
// dont show the folder data
if (is_array($subfolder)) {
// active _page
if($subfolder['url'] == $this->_page) {
$tmp_page = str_replace('{$label}', "page: ".$subfolder['label'], $this->navTpl['pageactive']);
} else {
$tmp_page = str_replace('{$label}', "page: ".$subfolder['label'], $this->navTpl['page']);
}
$tmp_page = str_replace('{$link}', "page: ".$subfolder['link'], $tmp_page);
$layer .= $tmp_page;
}
}
}
// new layer
$tmp .= str_replace('{$layer}', $layer, $this->navTpl['layer']);
} else {
vd("Fehler: Kein Array übergeben");
}
return $tmp;
}
}
Array
(
[0] => Array
(
[label] => obst
[type] => folder
[1] => Array
(
[start] =>
[label] => banane
[link] => banane.html
)
[0] => Array
(
[start] => 1
[type] => page
[label] => apfel
[link] => apfel.html
)
[2] => Array
(
[start] => 1
[type] => folder
[label] => kiwis
[0] => Array
(
[start] => 1
[type] => page
[label] => große
[link] => große.html
)
[1] => Array
(
[start] =>
[type] => page
[label] => kleine
[link] => kleine.html
)
)
)
[1] => Array
(
[label] => gemüse
[type] => folder
[0] => Array
(
[start] => 1
[type] => page
[label] => kartoffel
[link] => kartoffel.html
)
)
[2] => Array
(
[label] => fleisch
[type] => folder
)
)
[/script]