I use a skybluecanvas as my cms however it has no longer has any developer community, so i thought i'd ask my question here.
I have my main menu which is loaded using the code below.
This code is in my template file, used to call the menu code:
I have a second menu stored in xml but cant display it, changing the value of 'menu' has no effect. However in the 'view.php' code below where i have marked, there is a number 1 that when i change to 3 loads my new menu.Code:<div id="menu"> <!--#plugin:fragment(menu,view,menu=1)--> </div>
As an easy way round i tried to duplicate the menu code to create a new fragment but when i call it i only get a blank page as it loads the functions.php. So i need away to get the menu value from my template and pass it to view.php.
menu/functions.php (this code is loaded before view.php):menu/view.php:Code:<?php function the_class(&$item) { global $Filter; if ($Filter->get($_GET, 'pid', DEFAULT_PAGE) == $item->id) { echo ' class="active"'; } echo null; } function the_link(&$item) { global $Router; echo $Router->GetLink($item->id); } function the_text(&$item) { echo $item->name; } function not_valid_menu(&$item) { return empty($item->menu) || !$item->published; } ?>
Code:<?php global $Router; global $Filter; $menu = $Core->SelectObj( $Core->xmlHandler->ParserMain(SB_XML_DIR . 'menus.xml'), 1//<<<<< this is the value i need to change, the value of menu ); ?> <div class="horizontal-menu"> <?php if (count($data)) : ?> <ul id="mainmenu"> <?php foreach ($data as $item) : ?> <?php if (not_valid_menu($item)) continue; ?> <?php if ($item->menu != $menu->id) continue; ?> <li<?php the_class($item); ?>> <a href="<?php the_link($item); ?>"><span><?php the_text($item); ?></span></a> </li> <?php endforeach; ?> </ul> <?php endif; ?> </div>




Reply With Quote