By jmary on
I asked this in http://drupal.org/node/106718
The solution is quite simple actually :
In the file includes/themes.inc I have copied the function theme_links { .... } to a new function theme_linksa.
In this function, i have commented out the lines :
$output = '<ul'. drupal_attributes($attributes) .'>';
$output .= '<li class="'. $extra_class . $class .'">';
$output .= "</li>\n";
$output .= '</ul>';
I accept to hear that it's quick and dirty, but it works perfectly :
Now I'm calling my primary links with :
<?php if (isset($primary_links)) { ?>
<?php print theme('linksa', $primary_links, array('class' =>'links primary-links')) ?>
<?php } ?> Before it was called with :
<?php if (isset($primary_links)) { ?>
<?php print theme('links', $primary_links, array('class' =>'links primary-links')) ?>
<?php } ?>
Comments
fine,
but why don't you just override the theme_links function? At least I would put your new function in the template.php file. Would be cleaner I guess...
cheers,
chris
________________________
Austrian Drupal Usergroup
________________________
Drupal Austria Association
He he :-)
Simply because I still don't have a full understanding of the whole system structure.
I just kept pragmatic here. It works, I adopt it, and it works for all the themes, not only the one I want to use.
--
Julien MARY
--
You did well NOT to override the function, as it would probably have broken other things. For example, the primary links use that function, hence they are an unordered list : so THAT would probably be broken.
I used the exact same solution as you have, and it really is the best.
Caroline
However you can move your
However you can move your extra theme function in template.php
Here's my code :
In template.php I added this function. It is almost like the original function, only slighlty modified... not like yours I realize now, please take a look :
And I call that function in node.tpl.php :
It's clean and Drupalers-approved as the core remains untouched.
Caroline
It's a good idea to not modify theme.inc if you can help it
Your function's name is theme_linksa.
You can move it to template.php and rename it : phptemplate_linksa...
And in node.tpl.php, you can call it this way :
theme('linksa', ... )Good luck :)
Oupsy
Man... I am so tired.
So you have used this trick to change the HTML of the primary links.
So I meant to say that : by overriding the themeing function you would then have broken the themeing of links in nodes and taxonomy terms... among other things.
We just used the same trick for different things (and done so slightly differently) : you for primary links, and me for links and taxonomy terms in nodes. You in theme.inc, and me in template.php.
:) Sorry about that.
Why don't you just take care of it in CSS?
Shouldn't that do what you want?
It doesn't
I tried your suggestion but it doesn't work. :(
Can somebody just make a template for version 5.x where the primary links are listed vertically? Thanks so much. I have been spending hours trying to figure out how to do it. I have already tried your suggestions (many thanks for those), but still the effort is futile.
This works for me!
Hey, thanks. :)
This works well for me.
I don't mind redundancy. For now, I prefer function over form.
I just hope that someone can show us a more elegant way of solving this problem soon.