Hi,

I want to know how to change the main background color for each page in forest-floor theme with different colors.

Thanks,

Comments

Anonymous’s picture

Assigned: » Unassigned
Deepika.chavan’s picture

StatusFileSize
new159.08 KB
new157.96 KB

Hi,
A. If you want to give bg-color to main- content of each page, please try this :-
A-1. Add following function in forest_floor's template.php file to add id for individual node :

function phptemplate_preprocess_page(&$vars) {
    $vars['indiv_node_id'] = 'node-' . $vars['node']->nid;
} 

A-2. Replace following code in forest_floor's page.tpl.php :

    <div id="main" class="column" >  

With this one :

   <div id="main" class="column <?php print $indiv_node_id;?>">

A-3. Add following css to give background color for each page (node id will change accordingly):

 .node-2 {
  background: #FDF2EE;
}

.node-1 {
  background: #FEF5CA;
}

OR
B. If you want to give bg-color to wrapper of each page, please try this :-
B-1. Add following function in forest_floor's template.php file to add class for individual node :

function phptemplate_preprocess_page(&$vars) {
    $vars['indiv_node_id'] = 'node-' . $vars['node']->nid;
} 

B-2. Replace following code in forest_floor's page.tpl.php :

  <div id="wrapper" >

With this one :

  <div id="wrapper" class="<?php print $indiv_node_id;?>"> 

B-3. Add following css to give background color for each page (node id will change accordingly):

.node-2 {
  background: #FDF2EE;
}

.node-1 {
  background: #FEF5CA;
}

Rgrds,

Deepika Chavan

BrunoB-1’s picture

I'm a newbee and have some questions regarding to this post:

When you say: Add following function in forest_floor's template.php, do you simply have to add it at the bottom? When I open it with notebook, just past it at the end?

Add following css to give background color for each page (node id will change accordingly. Do I have to make a new .css file? Or ad it somwhere in the style.css?

Deepika.chavan’s picture

Hi ,

1. If "function phptemplate_preprocess_page(&$vars)" is already there in your template.php file, then just add following code anywhere inside that function :

   $vars['indiv_node_id'] = 'node-' . $vars['node']->nid;  

2. if it is not there then please add following code anywhere in template.php file (I added at the end of my template.php file) :

 function phptemplate_preprocess_page(&$vars) {
 
  $vars['indiv_node_id'] = 'node-' . $vars['node']->nid;

}

3. Good practice is to create new css file. but you can add that css code in style.css file also. (please clear cached data).

Rgrds,

Deepika Chavan.