Hallo,
ich habe ein Spezielles Menu und habe das Problem das ich bei der zweiten Ebene 1tens das Problem habe das bei "active" der li nicht geschlossen wird und 2tens es wird zweimal ein ul aufgemacht aber nicht geschlossen.
Ich finde den Fehler aber Partout nicht... hat evtl. jemand den Durchblick.
Code:
<div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<ul>
<?php foreach( $this->categories as $arrCat ): ?>
<li class="<?php echo $arrCat['css']; ?>"><a href="<?php echo $arrCat['href']; ?>"><?php echo $arrCat['title']; ?></a>
<?php if(is_array($arrCat['children'])) {
renderArray($arrCat['children']);
} ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php
function renderArray($items) {
print '<ul>';
foreach($items as $item) {
print '<li class="'. $item['css'] .'"><a href="'. $item['href'] .'">'. $item['title'] .'</a>';
if(is_array($item['children'])) renderArray($item['children']);
print '</li>';
}
print '</ul>';
}
?>
Danke
Gruß Ralf
Lesezeichen