Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By drupalzack on
If I have to theme just this from page.tpl.php print theme('links', $secondary_links)
, what is the right approach? I don't want to hack menu.inc/common.inc as some solutions.
Of course I could break up the creation of secondary_links in page.tpl.php itself, but I want to override the appropriate function. I just don't know what function.
I suppose the file would be template.php. What would the function name be? Or do I have to create a file bluemarine_? Why do we use one over the other? This always confuses me!
Thanks for your help.
Comments
Its quite common for
Its quite common for themable functions to be written differently than they are declared (I wish I understood why...). Fortunately the translation is always easy enough. theme('links', $links) is the equivolent of theme_links($links);
See:http://api.drupal.org/api/4.7/function/theme_links
So, to override the function in your template.php file, I'd recommend:
The variable is now sent to links.tpl.php "which you'll need to create". "$links" is an array, so it should be easy enough to work with
--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
http://www.nicklewis.org
--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
Personal: http://www.nicklewis.org
Work: http://www.zivtech.com
theme function
As (sort of) explained at http://api.drupal.org/api/4.7/function/theme, all calls to theme_* functions should go through theme().
From my understanding, this is an extra level of indirection/abstraction that translates from generic theme_* function name to the appropriate themename_* function based on the current theme to use. Because PHP4 doesn't allow you to redefine an already existing function name, your theme overrides can't use the same name as the existing default ones.
I hope that makes some sort of sense :)
--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal
Thank you! Really
Thank you! Really appreciated.
Um... that makes a truckload
Um... that makes a truckload of sense. Thanks!
--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
http://www.nicklewis.org
--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
Personal: http://www.nicklewis.org
Work: http://www.zivtech.com