This is a backup of my old blog, some posts may still be usefull.
Check out my Tumblog @ http://pagebakers.nl/

Drupal: Adding a tertiary menu to your theme

Unfortunately Drupal only allows you to add primary and secondary menu’s by default. However there are times you need deeper levels, for example a third (tertiary) level submenu.
After some searching and looking at the core code I came up with a pretty easy solution.

First add the following functions to your template.php file.

function phptemplate_preprocess_page(&$vars) {
    $vars['tertiary_links'] = menu_tertiary_links();
}

/**
 * Returns an array containing the tertiary links based on the primary menu.
 * Tertiary links can be either a third level of the Primary links
 * menu or generated from a second level of the explicitly defined secondary_menu
 */
function menu_tertiary_links() {
    if (variable_get('menu_secondary_links_source', 'secondary-links') == variable_get('menu_primary_links_source', 'primary-links')) {
    return menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2);
  }
  else {
    return menu_navigation_links(variable_get('menu_secondary_links_source', 'secondary-links'), 3);
  }
}

Once you’ve done that, you can add this snippet in your template.

<?php if (isset($tertiary_links)): ?>
    <?php print theme('links', $tertiary_links, array('class' => 'links tertiary-links')); ?>
<?php endif; ?>

And voila! you’re done.

17/11/2010 at 12:41 pm — Comments (0)

SoapSource added into the Cakephp datasources repository

Today my Soap datasource has been added into the Cakephp datasources repository by Graham Weldon.
Great to see my work got accepted.

02/03/2010 at 3:02 pm — Comments (0)

Older posts Subscribe to RSS

Fixed (sticky) toolbars with jQuery

19/01/2010

Book review: CakePHP Application Development

11/03/2009

GIT: ignoring changes in tracked files

29/01/2009

SoapSource, a SOAP Client Datasource for CakePHP

18/12/2008

Installing PHP5 soap extension on Leopard 10.5.5

17/12/2008

Cakephp router and prefixes

04/12/2008
CoCre8