Closed (fixed)
Project:
Sections
Version:
6.x-1.4
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Sep 2010 at 07:23 UTC
Updated:
11 Oct 2010 at 16:50 UTC
Hi,
I dont want to change the entire theme. I just want a different stylesheet for different sections.
Is that possible?
Comments
Comment #1
hass commentedYes, but not with sections module.
Comment #2
jbernal.web.dev commentedHi pareen -
I'm new to Sections and have only gotten as far as browsing through the Sections module code in
sections.module. But I know you don't need Sections to accomplish what you want to do (so my explanation here doesn't involve Sections.) There is a built-in Drupal function to add a CSS file to a theme calleddrupal_add_css(). When combined with path checking, you can invoke your CSS file for only certain paths. Both path checking anddrupal_add_css()can be combined in your theme's page preprocessor, oryourthemename_preprocess_page()to produce the kind of behavior you're looking for.Remember that if your theme name is flowers then the preprocess function would be named
flowers_preprocess_page(&$vars)You can include preprocess functions in your theme'stemplate.phpfile. If your theme doesn't have atemplate.phpfile you can simply create the file in your theme's directory.So you would have:
Notice that $vars['styles'] is available to your theme's page.tpl.php and other page template files as simply
$styles.Comment #3
hass commentedSend me an email if you need some paid consulting, please.
Comment #4
pareen commentedThanks Jose.
It works!
However, I was looking out for some way I could accomplish this without getting into php.
Is there any module that adds css classes based on url/path?
@hass: thanks