2010-11-09, 19:52:11
Quick simple function, added in functions.php of template script
and then called by template <?php kry_menus_konsertina(); ?>
Hope it helps somebody.
tx
and then called by template <?php kry_menus_konsertina(); ?>
Code:
<?php
function kry_menus_konsertina(){
$items = menu_data();
foreach ($items as $item) {
if (($item['menu_status'] == 'Y') ) {
if ($item['parent_slug'] == '') {
$pItem[$item['menu_priority']] = array("url" => $item['url'],"slug" => $item['slug'],"menu_text" => $item['menu_text'],"parent" => $item['parent_slug'],"priority" => $item['menu_priority']);
} else {
if (isset($counterC[$item['parent_slug']])) {
$counterC[$item['parent_slug']]++;
} else {
$counterC[$item['parent_slug']] = 1;
}
$cItem[$item['parent_slug']."_".$counterC[$item['parent_slug']]] = array("url" => $item['url'],"slug" => $item['slug'],"menu_text" => $item['menu_text'],"parent" => $item['parent_slug'],"priority" => $item['menu_priority']);
}
}
}
$actS = return_page_slug();
for ($x = 0;$x <= 30; $x ++) {
if (isset($pItem[$x])) {
$slug = $pItem[$x]['slug'];
$aktiev = false;
if ($actS == $slug) {
$aktiev = true;
} else {
if (isset($cItem[$pItem[$x]['slug']."_1"])) {
$hoevC = $counterC[$pItem[$x]['slug']];
for ($tmpX = 1; $tmpX <= $hoevC;$tmpX++) {
$tmpI = $cItem[$pItem[$x]['slug']."_$tmpX"];
if ($actS == $tmpI['slug']) {
$aktiev = true;
}
}
}
}
if ($aktiev == true) {
echo "<div id='konsertina_hoof' class='konsertina_hoof'><a href='".$pItem[$x]['url']."' class='".$pItem[$x]['slug']."'>".$pItem[$x]['menu_text']."</a>";
if (isset($cItem[$pItem[$x]['slug']."_1"])) {
echo "<div class='konsertina_sub_items'>";
$hoevC = $counterC[$pItem[$x]['slug']];
for ($tmpX = 1; $tmpX <= $hoevC;$tmpX++) {
$tmpI = $cItem[$pItem[$x]['slug']."_$tmpX"];
echo "<a href='".$tmpI['url']."' class='".$tmpI['slug']."'>".$tmpI['menu_text']."</a><br/>";
}
echo "</div>";
}
echo "</div>";
} else {
echo "<div class='konsertina_hoof'><a href='".$pItem[$x]['url']."' class='".$pItem[$x]['slug']."'>".$pItem[$x]['menu_text']."</a></div>";
}
}
}
//error_log(print_r($pItem,true));
//error_log(print_r($cItem,true));
}
?>
Hope it helps somebody.
tx
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.