By chadcross on
Hello,
My second post. Yahooo. this is a refinement of another post but I couldn't find a way to edit the other post.
I have the code below for a secondary nav. It works perfectly. I am just missing one important piece of information. See where it says "Need current page listed here"? I would like to display the name of the main nav item that this secondary nav is organized under. Is there a piece of PHP code that I can put in there to make that display? Thanks for looking at this.
<?php if (is_array($secondary_links)) : ?>
<div class="titleSubnav">Need primary nav item listed here</div>
<div class="navContainer">
<ul class="subnav">
<?php foreach ($secondary_links as $link): ?>
<li><?php print $link?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Comments
A Simple PHP solution
I am fairly new at drupal, and was looking to do the exact same thing. Here is the way I solved it for my site:
Since the title of the secondary navigation should just be the active link in the primary menu, I just added this code into the spot where you have "Need pimary nav item listed here":
Hope this helps!
Mike
Almost there...
This thread solves my [related] problem as well (http://drupal.org/node/75486).
Great work. Now the question is, how do you just get the title (not the complete URL etc.)? For example, doing a var_dump($primary_links) shows the following:
string(95) "<a href="/drpperformance/node/6" title="This is our Services page." class="active">Services</a>"All we need here is the title, not the whole link.
...there
To just get the title and not the whole link, take my code above and replace
print $value;withprint strip_tags($value);.Code for Drupal 6
This returned an Array in Drupal 6, here's the code that worked for me:
=-=-=-=-=-=-=-
Miles
A Less Simple PHP+Template Solution
Posted to: Secondary Links Menu Tree.