Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / how to add different background colors to different pages?

how to add different background colors to different pages?

Locked

Views: 2,490

Results 1 to 20 of 38
This thread is locked. New replies are disabled.
24 Aug 2010, 5:15 PM
#1
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

how to add different background colors to different pages?

when i change background for the product listing page to black , it changes all other pages to black as well, how do i make the other page just stay white for the background color.

thanks,
hangman21

24 Aug 2010, 5:34 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: how to add different background colors to different pages?

Smart Backgrounds from Free Addons may be your best bet. Ordinarily you could use a per-page stylesheet, but product listings and category listings all share the "index" pagename.

24 Aug 2010, 10:04 PM
#3
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

hey thanks alot, i tried install the smart background, everytime i upload the modified tpl_main_page everything disappears on the page.

What i am doing wrong

25 Aug 2010, 7:42 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: how to add different background colors to different pages?

Did you already have a copy of tpl_main_page.php in your custom template folder? If so, you can merge the one line that is changed in it for Smart BG into your copy.

25 Aug 2010, 9:09 PM
#5
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

yea i already had a copy of the tpl_main_page unedited and I tried just merging the codes as well, and the same results. I was thinking of div tags do you think that would be alright and and what would be the proper way to do it for each page

i have done this far i made the

contentmainwrapper: white
navcolumn 1 and 2: black
.centerBoxContentsProducts : black

.centerBoxContentsProducts, is surround by a white border, i am guessing that white is showing from the contentmainwrapper, but i change the contentmainwrapper to black the individual product pages goes black as well... i dont know what to do from here or at least is there to make white border hidden, heres the site address to take a better look

http://sunkissed.hostzi.com/shops/index.php?main_page=index&cPath=1

thanks

26 Aug 2010, 3:36 AM
#6
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

ok i got some place, i forgot to upload a file from the package, but i dont think i am writing the coding correct the cause that area of the page is still white

.smartBG_main_page=index&cPath=1 #contentMainWrapper {
background-color: #000000;
}

26 Aug 2010, 4:08 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: how to add different background colors to different pages?

.smartBG_main_page=index&cPath=1 #contentMainWrapper {

The red part can't be right here. See the readme for the correct form of classname to use.

26 Aug 2010, 5:46 AM
#8
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

so the read is saying to write it as this .smartbg_1 #contentMainWrapper if you could please show how to write it, that will be nice

thanks

27 Aug 2010, 1:32 AM
#9
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

still stuck on trying out different forumlas

so far i tried the following and none of them seem to be working, i even tried creat background with the same image name as the example but doesnt seem to work as well

I am placing my coding in the smartbg_stylesheet and i even tried placing it in the stylesheet.css, but nothing changes happens

.smartbg_index.php?main_page=index&cPath=1 #contentMainWrapper {background-color: #000000; }

.smartbg_main_page=index&cPath=1 #contentMainWrapper {background-color: #000000; }

.smartbg_cPath=1 #contentMainWrapper {background-color: #000000; }

.smartbg_1 #contentMainWrapper {background-color: #000000; }

27 Aug 2010, 1:45 AM
#10
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

To switch backgrounds for a single subcategory, add its cPath like ## to smartbg.

i also tried this well .smartbg_1_1 #contentMainWrapper {background-color: #000000;}

27 Aug 2010, 1:57 AM
#11
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

I also tried doing this

<body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo smart_backgrounds('../images/smartbg_page5.gif');?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>

and tried typing the coding like this

<body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo smart_backgrounds('smartbg_page5.gif');?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>

.smartBG_1 #contentMainWrapper {background-image: url(../images/smartbg_page5.gif);}

and i checked to see if the picture is save as .gif and it is

27 Aug 2010, 8:30 AM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: how to add different background colors to different pages?

Changing the parameters in the <body> tag will definitely make it not work. It needs to stay as originally written unless you want to use other than .gif images.

The last stylesheet rule you show should change the background on category 1. Do you have an image named smartbg_1.gif? Where exactly is it saved?

27 Aug 2010, 8:17 PM
#13
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

i never change any paraments in the body tag the directions told me to

<body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo smart_backgrounds('smartbg_page5.gif');?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>

the only thing i added in was this... 'smartbg_page5.gif' as stated in the read me file

i am confused why would i need page smartbg_1.gif when the file name is smartbg_page5.gif, which i saved the image as that

i give up how is it suppose to written

28 Aug 2010, 4:37 AM
#14
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

ok i am getting some place now, i view the html source code in ie at its reading the code now <body id="indexBody" class="smartBG_1">

.smartBG_1 #contentMainWrapper {background-image: url(../images/smartBG_1.gif);}

but i do not see the image on there

http://sunkissed.hostzi.com/shops/index.php?main_page=index&cPath=1

28 Aug 2010, 4:48 AM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: how to add different background colors to different pages?

That's because the image file doesn't exist on your server.

28 Aug 2010, 4:51 AM
#16
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

the image file is on my server i can take a print screen of it, and its in templates/mytemplate/images

i see i just .gif to smart_backgrounds('.gif') not the whole file name... going to test it out and see if it works

nope that didnt work^^^

28 Aug 2010, 4:58 AM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: how to add different background colors to different pages?

Your stylesheet, located at http:// sunkissed.hostzi.com/shops/includes/templates/sunkissedvahinez/css/stylesheet_smartbg.css
says:
.smartBG_1 #contentMainWrapper {background-image: url(../images/smartBG_1.gif);}

The "../" in there refers to one folder up from that stylesheet, so that means it's trying to load the following image:

http:// sunkissed.hostzi.com/shops/includes/templates/sunkissedvahinez/images/smartBG_1.gif
... which does NOT exist presently.

28 Aug 2010, 5:03 AM
#18
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

why is my other images being read properly in stylesheet.css cause thats how they are written ../images/background3.jpg and the example tells you to write them that way

28 Aug 2010, 5:08 AM
#19
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: how to add different background colors to different pages?

I'm not sure what magical guessing game you think the browser should do for you.
If you tell it to show an image, but give it an invalid filename, then it's not going to show it. It's that simple.
It does exactly what you tell it to do. Nothing more.

And, if you can't visit the image directly with your browser, as I gave you an example above, then the browser won't display that image on your other pages either.

28 Aug 2010, 5:08 AM
#20
hangman21 avatar

hangman21

Zen Follower

Join Date:
May 2010
Posts:
138
Plugin Contributions:
0

Re: how to add different background colors to different pages?

i know why cause i saved the image with lowercase bg

when i type in the link you tried to look with lowercase bg it goes to the site
http://sunkissed.hostzi.com/shops/includes/templates/sunkissedvahinez/images/smartbg_1.gif

so i have to change them BG

thanks byte, i wouldnt have notice that without your help, it should work now

now your link works