By kmark on
I'm trying to convert an XHTML / CSS template into a Drupal theme. However, I've run into some problems. The primary link structure for the template is this:
<ul align="center">
<li align="center"><a href="index.php"><span>Home</span></a></li>
</ul>Now the problem I'm having is that when I use:
if (isset($primary_links)) :
print theme('links', $primary_links, array('class' => 'links primary-links'))
endif; It outputs:
<ul class="links primary-links" align="center"><li class="menu-115 active-trail first last active"><a href="/node" title="" class="active">Home</a></li>
</ul>
It displays the nav bar incorrectly because of the lack of <span></span> tags between the text. Is there any way to tell Drupal to put these tags in between the text? Any help is appreciated! :)
Comments
You'll need to either
Override theme_links() in your theme, or adjust the CSS to fit the HTML.
See http://drupal.org/node/341628 for info about theme overrides.
--
Anton
Right, I have this problem -
Right, I have this problem - I've done this etc and it all works.. Right..
But now I want to also have a second theme_links() function to add extra HTML for another navigation..
How can I do this?
A couple of ways
You could either add a conditional check inside your override that varies the HTML depending on the circumstances,
or
You could create a second copy of the override (eg yourthemename_links2() ) and call it differently from your page.tpl.php
eg:
Note the theme('links2', .... ) bit calls your new theme function.
I'd recommend the first option to reduce code duplication.
--
Anton
Second method does not
Second method does not work.. I'll just make a conditional statement :(
This may be because you need
This may be because you need to register function by declaring it in
THEMENAME_theme()inside yourtemplate.php. As in:Then simply add another function to your
template.php, which will actually do the job:Now, rebuild theme registry (http://drupal.org/node/173880#theme-registry) and your new theme function is accessible, for example from
page.tpl.php:Notice how custom_primary_links appears in registering part, function definition and final theme function call.
Yep say no to conditional checks!
Getting a <span> tag around each navigation
In short, I'm trying to get tags around each nav "part".
Thanks! I'll try that!
Thanks! I'll try that!
Ok I copied the theme_links()
Ok I copied the theme_links() to my theme's template.php as mytheme_links() however no changes I make are taking effect.
Tried flushing the cache a billion times. I am using Primary Links as a block however instead of built into the page.tpl.php, will this make a difference?
Is there any way to figure out what template files are being parsed?
Thanks :)