Drupal 6 - output your primary links as a Site Map

Oct 06, 2008

This took me a while to find: In Drupal 6, I wanted to output the main Primary Links menu item, expanded, as a site map: Simply add the following to a node (with PHP parsing ON!)

<?php
$tree = menu_tree_all_data($menu_name = 'primary-links', $item = NULL);
print menu_tree_output($tree);
?>

Comments

flevour

flevour wrote on 12/23/08 1:35 AM

The code you may actually want is this (those PHP between parenthesis is quite wrong, even if it works):
&lt;?php
$tree = menu_tree_all_data(''primary-links');
print menu_tree_output($tree);
?&gt;
Thanks for sharing,
Francesco
Tom k

Tom k wrote on 12/23/08 2:05 AM

Many thanks: still getting used to both PHP &amp; drupal!
Muthuraman

Muthuraman wrote on 11/19/10 4:21 AM

Many Thanks Guys ...

Still stuck in site map :(
i am beginner in drupal 6 ... Need to know how to create a site map page using views & theme it bcoz i have footer menu and left menu etc....
Tom K

Tom K wrote on 11/19/10 2:15 PM

You could use the PHP input filter to create a page with a number of these scripts on. In the abov examples, Primary Links is being called, but there's nothing stopping you calling another menu by it's machine name.
Muthuraman

Muthuraman wrote on 11/20/10 7:11 AM

Thanks Tom,

is that a right way of doing sitemap in a page using php filter ? i have used the above method .. its work fine ...

i am interest to create a module with will automatically find the list of menu and grab it to site map .. i dont whether some contributed module already does this .. but still researching on that .. need some idea ...

Thanks for your support :)
Tom K

Tom K wrote on 11/20/10 9:53 AM

I've not tried it, but there is a site map module:

http://drupal.org/project/site_map

Which I imagine is probably more along the lines of what you're looking for!

Write your comment



(it will not be displayed)





About Tom

Tom is the author of this blog and the brains behind OxAlto Design More ...

Categories

Monthly Archives

Links

Tag Cloud

coldfusion web-development internet misc music cfwheels railo drupal vps chchchoir blueprintcss jquery mangoblog flex ipod mac wowza demos flash flickr google hinkseystudio itunesu wallpapers wordpress

Feeds