On 6/25/08 6:18 PM, "Jonathan Hedstrom" jhedstrom@opensourcery.com wrote:
Jody Cleveland wrote:
On 6/25/08 5:45 PM, "Richard Burford" rich@freestylesystems.co.uk wrote:
I've not built a theme for Drupal 6 yet but in Drupal 5 what you can do is add a body class based on what's in arg(). This can be done in template.php.
I tried adding this to template.php, but it didn't seem to do anything (body tag still shows up as just <body>:
print '<body id="'. arg(0) .'" '; print theme('onload_attribute'); print ">";
Do I have that right?
- jody
What you have there should work.
Alternatively, if you want to use different css files based on path, you can do something like this at the top of template.php:
switch (arg(0)) { case 'admin': drupal_add_css(path_to_theme() .'/admin.css', 'theme', 'all'); break; case 'somethingelse': drupal_add_css(path_to_theme() .'/another-css-file.css', 'theme', 'all'); break; }
Still not working for me. I placed this at the top of my theme's template.php:
switch (arg(0)) { case 'admin': drupal_add_css(path_to_theme() .'/admin.css', 'theme', 'all'); break; case 'teens': drupal_add_css(path_to_theme() .'/teens.css', 'theme', 'all'); break; }
The url path I'm trying to change the css for is /teens and the css file I'm trying to use is teens.css. I've tried clearing the cache, but when I view the source of the teens page, there's no reference to teens.css. Is there something else I missed? Can I also use this with wildcards? (case 'teens/*' so that all pages within that area get that theme)
Thank you so much for your time in helping me with this.
- jody