We currently run a Drupal site within a university web space and would like to know if it is possible to add the university's home page as a constant link at the beginning of all generated breadcrumbs?
We currently run a Drupal site within a university web space and would like to know if it is possible to add the university's home page as a constant link at the beginning of all generated breadcrumbs?
Comments
Comment #1
jweowu commentedYou might wish to simply over-ride theme_breadcrumb()
Comment #2
brett_wilson commentedi'm still not sure how this can be achieved. for future releases and upgrades we are trying to keep module modifications to a bare minimum.
Comment #3
jweowu commentedIf you have a custom theme, just implement mytheme_breadcrumb() in template.php.
If you're using a core or contrib theme and don't want to touch it, then Drupal 6 has a nice way for you to over-ride theme functions with a custom module.
http://api.drupal.org/api/function/hook_theme_registry_alter/6
In either case, remember to clear the theme registry cache, otherwise Drupal won't see the change.
(The admin_menu module provides handy links for cache clearing.)
Comment #4
brett_wilson commentedThanks for the reply but i'm still getting how to implement this. where should this code go?
Comment #5
jweowu commentedOkay, you definitely need to do a bit of reading about the Drupal theme and module systems.
It will help you tremendously in the long run if you understand how to over-ride things without touching the core code.
For the above code, you would create a new custom module (or extend an existing one). I've used 'mymodule' as a name, but you would replace each instance of that with the actual name you wish to use. Choose something unique (perhaps the name of your university), as PHP does not have namespaces, so function names can clash if you choose poorly.
You would create a directory somewhere under sites/all/modules. It can be deeper than that -- you can separate out your custom and contrib modules by putting contrib modules in sites/all/modules/contrib/ and custom modules in sites/all/modules/custom/
So you might have:
sites/all/modules/contrib/menu_breadcrumb/
sites/all/modules/custom/mymodule/
Inside the mymodule directory, make two files:
mymodule.info
mymodule.module
See other .info files for examples, but the following would suffice:
mymodule.module would contain the previous code.
Then enable the module in Drupal. That will probably clear the theme cache registry automatically.
I hope that helps, but like I said -- start reading the documentation!
Comment #6
brett_wilson commentedthanks so much. This helps greatly. I am in the process of getting my head around Drupal. So thanks again for the reply.
Comment #7
jweowu commentedYou're welcome. Happy Drupaling :)
Comment #8
xurizaemonMarking support, fixed. Thanks jweowu.