The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hack to generate submenus ...
#1
Hello ...
A little hack to genrate submenu of the current page

put this code in your template ...

Code:
<?php
$sm = '';

$sm1 = '';
$data=simplexml_load_string(menu_data('',true));
$topmenu= subval_sort($data->xpath("//*[menuStatus='Y']"),'menuOrder');
foreach ($topmenu as  $menu){
// output the top level menu items
   //$sm .= "<li>".$menu->slug."</li>";
   $submenus= $data->xpath("//*[parent='".$menu->slug."']");
// output submenu if it exists
   if (count($submenus) != 0) {  
    
     $sm1 = '';
     $sm1 .= "<ul class='submenu'>";
     if ( trim(return_page_slug()) == trim($menu->slug)) { $sm1ok = 1; } else {    $sm1ok = 0; }

     foreach ($submenus as $submenu){
        if ( trim(return_page_slug()) == trim($submenu->slug)) { $sm1ok = 1; }
         $sm1 .= '<li><a href="'.$menu->slug.'/'.$submenu->slug.'">'.$submenu->slug."</a></li>";
     }

    $sm1 .= "</ul>";
    if ($sm1ok == 1) {
        $sm .= $sm1;
     }
    
    }
}
echo $sm;
?>
Reply


Messages In This Thread
Hack to generate submenus ... - by caviar - 2010-04-09, 00:32:13
Hack to generate submenus ... - by caviar - 2010-04-09, 00:37:26
Hack to generate submenus ... - by Zegnåt - 2010-04-09, 02:30:30
Hack to generate submenus ... - by caviar - 2010-04-12, 19:08:23
Hack to generate submenus ... - by caviar - 2010-04-16, 23:24:42
Hack to generate submenus ... - by cumbe - 2010-04-17, 21:44:33



Users browsing this thread: 2 Guest(s)