« Return to Thread: Different stylesheet based on path

Re: Different stylesheet based on path

by Jonathan Hedstrom-2 :: Rate this Message:

Reply to Author | View in Thread



Jody Cleveland wrote:

> On 6/25/08 5:45 PM, "Richard Burford" <rich@...> 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;
}

Cheers,

Jonathan

--
Jonathan Hedstrom                                     OpenSourcery
http://opensourcery.com                        Technology for Good




--
[ Drupal support list | http://lists.drupal.org/ ]

signature.asc (196 bytes) Download Attachment

 « Return to Thread: Different stylesheet based on path