By CWolff on
I'm having sort of an issue...I'm currently customizing a theme and creating a css nav bar from the primary links. The thing is, the nav bar is too short (horizontally) and I can't add any more padding otherwise it'll overflow. So...I'm trying to assign individual classes to the primary links
I'm assuming there's a function somewhere like:
while (whatever){
print "
"
}
But I cant' seem to find it, can someone help me out here?
I'm trying to modify that function to read:
while (whatever){
print "
"
}
Comments
Gah, what I meant was: I'm
Gah, what I meant was:
I'm having sort of an issue...I'm currently customizing a theme and creating a css nav bar from the primary links. The thing is, the nav bar is too short (horizontally) and I can't add any more padding otherwise it'll overflow. So...I'm trying to assign individual classes to the primary links matching the name of the title of the li tag
I'm assuming there's a function somewhere like:
But I cant' seem to find it, can someone help me out here?
I'm trying to modify that function to read:
------------------------
Cassandra Wolff
PHP Developer
Gaiam Inc.
Direct: 303-222-3676
cassandra.wolff@gaiam.com
Check your page.tpl.php. It
Check your page.tpl.php. It probably includes something like
print theme('links', $primary_links, array('class' => 'links primary-links')). Check theme_links on http://api.drupal.org; this function is used to "theme" all links which are handled as such by Drupal. Possibly also have a look at theme_menu_links.You may then want to create your own function phptemplate_theme_primary_links say in template.php based on the above. In page.tpl.php you can call directly, or via theme('primary_links', ...).
There may be neater ways of doing this (I find this part of the menu/themeing system a bit confused/ing, partly because themeing of menus in blocks and across the top of the page is handled differently) but this should get you started.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Thank you GPK! You were
Thank you GPK!
You were right, the function was actually declared as theme_menu_links in menu.inc. I decided not to just override the function since this template is exclusive to only this project for my company. Instead, I just added the class and $link['title'] like so:
Thanks again, you were tons of help.
------------------------
Cassandra Wolff
PHP Developer
Gaiam Inc.
Direct: 303-222-3676
cassandra.wolff@gaiam.com
You might still want to put
You might still want to put rename your final function to phptemplate_menu_links() and put it in template.php. That way, if you need to upgrade Drupal in the future, you won't have to re-customise menu.inc again (i.e. avoid hacking core if possible)
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Thanks GPK, I went ahead and
Thanks GPK, I went ahead and did that because you're right. It would be a pain to have to go through all the core files if my company decides to do an upgrade or screws something up.
------------------------
Cassandra Wolff
PHP Developer
Gaiam Inc.
Direct: 303-222-3676
cassandra.wolff@gaiam.com
:-) gpk ---- www.alexoria.co.
:-)
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk