[support] Different stylesheet based on path
Jonathan Hedstrom
jhedstrom at opensourcery.com
Wed Jun 25 23:18:32 UTC 2008
Jody Cleveland wrote:
> On 6/25/08 5:45 PM, "Richard Burford" <rich at 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;
}
Cheers,
Jonathan
--
Jonathan Hedstrom OpenSourcery
http://opensourcery.com Technology for Good
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.drupal.org/pipermail/support/attachments/20080625/d03b46fc/attachment.pgp
More information about the support
mailing list