Hi all,
I dont like starting threads that already exist but i am stuggling to understand why i cant get span tags to be applied to my primary links.
I see this post: http://drupal.org/node/112761 and thought this must be it but when i follow these instructions my primary links disapear altogether!
I want to change my primary links from:
<li class="menu-197"><a href="#" title="">Link1</a></li>
to:
<li class="menu-197"><span><a href="#" title="">Link1</a></span></li>
I have copied the theme_links function from theme.inc and pasted it in the template.php file within my theme directory.
I have chnaged this line:
function theme_links($links, $attributes = array('class' => 'links')) {
to:
function phptemplate_primary_links($links, $attributes = array('class' => 'links')) {
and changed template.php
Chnaged this:
if (isset($primary_links)) :
endif;
to this:
if (isset($primary_links)) :
print theme('primary_links', $primary_links, array('class' => 'links primary-links'))
endif;
That is all i have chnaged and the primary links do not show at all. I must be doing a typo but i cant grasp what error has been made.
Can you help?
Thanks in advance
M
Comments
Whenever you add a new
Whenever you add a new function to your template.php file, you need to clear your theme registry.
There could be other issues as well, just checking that you've done this.
How do i clear the theme registry
I didnt know that. thank you. i will look into how i do this and feedback.
Thanks
Its still broken
Ok i have cleared my theme registry and the primary links still dont show.
I followed this instruction:
On the "Administer > Site configuration > Performance" page, click on the "Clear cached data" button
Any ideas why my primary links dont show after following the above ?
Thanks
Add span to Primary Links
Ok i seem to be getting somewhere in that i have now managed to get span to be in my primary links. The problem i have is the
<span>
is wrapping around the wrong element.Currently the
<span>
is wrapped around the link text in the anchor tag:<li class="menu-197"><a href="#" title=""><span>Link1</span></a></li>
i want to wrap the
<span>
around the anchor tag itself, like this:<li class="menu-197"><span><a href="#" title="">Link1</a></span></li>
Here is the template.php file thats in my themes folder:
And here is my page.tpl.php page:
Does anyone know how i wrap the
<span>
around the anchor tag?Thanks in advance.
M
add span to primary links
I think it's this line
$output .= l('<span>'. $link['title'] .'</span>', $link['href'], $link)
the "l" is the link command that generate the anchor tags so the spans should be outside that bit!
e.g.
$output .= '<span>'.l( $link['title'] , $link['href'], $link).'</span>'
Splendid and Tremendous
Excellent! that's done the trick!
Thanks
Image inside
How can I change code for this:
?