Hello everyone,
I'm attempting to implement graphical tabs for my primary links in a customized theme. I'm using the lastest 4.7 beta, and working off a copy of bluemarine, doing incremental changes to the CSS to achieve what I want.
I have already reviewed:
But I've run into a couple of problems:
1. The page.tpl.php code it refers to [ if (count($primary_links)) ... etc] that you need to swap out to differentiate the active tab appears to have disappeared from the latest incarnation of the bluemarine theme. Where has this gone?
2. As a starting point for customization, I've copied in the css code at the node referenced above into my stylesheet, and I'm using the the tab graphics from http://www.alistapart.com/articles/slidingdoors. You can see the results here: http://www.whatdoesthatmean.ca which looks absolutely nothing like http://www.alistapart.com/d/slidingdoors/v1/v1.html.
At this point I'm not sure if that's failed because I've been unable to implement the PHP code change that's shown, or for another reason.
3. I'm also not clear, because the documentation hasn't been updated (I don't think - couldn't find it anyway) as to whether I need to download and install a theme engine separately if I'm using 4.7. I gathered from http://drupal.org/drupal-4.7.0-beta that PHP was the default engine and was incorporated into the Drupal core code, but obviously I could be mistaken about that.
Any help that will get me closer to my graphical tabs will be welcome. :)
Chandra
Comments
1. How the primary and
1. How the primary and secondary links are handled has changed in 4.7, see blue marine for example code now. Control of this has been moved to the menu module so let's hope that menu module has active code.
2. haven't tried it yet or looked into it, so it's not surprising that it doesn't work. When someone figures it out, hopefully they'll add a page. As we added versioning to the handbook recently, I've tagged that specific page for 4.6 for future reference. Unfortunatly I don't have time right now to really dig into it, so hopefully someone else will wander by who can.
3. There isn't much on theming yet for 4.7. There is a page with some information on updating theme's, but it's not nearly ready at this point http://drupal.org/node/25297. By browsing th etheme\engine directory, you can see the engine included with a default Drupal install 4.7. That will be phptemplate
-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
hard-code hack in page.tpl.php
This isn't a full solution, but I decided to just hard-code a menu for now, i havn't added the rollover functionality yet. Nor even graphically designed the buttons. You can see results at http://www.bikthehub.org/nehwi.
Here is the code a added to the page.tpl.php file for pushbutton theme in 4.7BETA:
I put the above code right after the close of the table labeled, "primary-menu".
Hope that helps.
Same problem
I'll wait for a real fix... anyone? Marking this message so that I can follow updates more easily.
URL typo just above...
http://www.bikethehub.org/nehwi will get you to the link posted just above.
Not sure about the "active" part.
But there is an easy way to get a <ul> out of the new Menu based Primary and Secondary links. Use this in your theme to generate an unordered list -- theme('menu_links', $primary_links)
see the documentation here:
http://drupaldocs.org/api/head/function/theme_menu_links
and here:
http://drupaldocs.org/api/head/function/theme
I am still playing with it, but it should do what you desire.
---
Code0range: Drink Your Juice
Addendum
Just to clarify my previous comment, theme('menu_links', $links) does return which item is "active" by tagging it with the class="active". You should be able to use this to get what you want.
One problem I found is that it looks like there is no way to override the <ul> class output of this function. As it stands the function outputs <ul class=\"links-$level\"> which does not help with themeing primary and secondary links. Also, overriding this would do so for all the menu links too. To get around issue this I wrote a new function based off theme_menu_links and placed it in my template.php file:
calling this in my page.tpl.php file like so:
print theme_nav_links($primary_links, 'main-nav');Will print out html like this when a link is active:
Hope this helps, and maybe someone will offer up an improved way of doing this.
---
Code0range: Drink Your Juice
delete
delete
Found the trick
The trick to changing the way links are output as html is to add to the php-template functions for your particular theme, by creating a new file /themes/mytheme/template.php:
I used the CSS from here to complete the job:
http://drupal.org/node/31704
However, it was necessary to change the image urls in the CSS to absolute urls to make it work, for example: url("/images/bg.gif") instead of url("images/bg.gif")
----
www.whatdoesthatmean.com
Which makes all sets of links in the site into lists... ooops
If you only want to change the one set of links to an unordered list, you can do it by hacking page.tpl.php:
----
www.whatdoesthatmean.com
Thanks for sharing this
Thanks for sharing this snippet! It worked like a charm. I changed the first
<ul>to<ul id="primary">as you had commented out and removed the surrounding<div>,<div id="primary">to minimize code bloat.Insert an image between lists
Hello,
Do you know how to prevent the image from appearing in the end of the last menu?
José Fernandes
Bloomidea