Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Background image not showng on main page

Background image not showng on main page

Views: 1,114

Results 1 to 13 of 13
1 Dec 2011, 3:48 PM
#1
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Background image not showng on main page

Any idea why the body background image would not show on the main page, but show on all other pages ? On the main page the background image flashes up briefly, then seems to get overridden with just blank white. However all other product pages show the same background image properly. I gather it's getting overridden somewhere, but not sure where. v 1.3.9h

i.e the body background image

body {
background: url("../images/background2.jpg") repeat scroll 0 0 transparent;
margin: 0;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 62.5%;
color: #000000;
/* background-color: #FFFFFF; #F1F3E9; #172317; #031903; #000000; #F1F3E9; #e5edf5; */
}

1 Dec 2011, 4:53 PM
#2
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Background image not showng on main page

I again presume it has to be the style sheet that's the problem and not the php scripts.

1 Dec 2011, 4:58 PM
#3
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Background image not showng on main page

We might be able to spot something with a link to the site.

2 Dec 2011, 1:35 AM
#4
usernamenone avatar

usernamenone

Totally Zenned

Join Date:
Sep 2006
Posts:
541
Plugin Contributions:
0

Re: Background image not showng on main page

HeyIts007:

Any idea why the body background image would not show on the main page, but show on all other pages ? On the main page the background image flashes up briefly, then seems to get overridden with just blank white. However all other product pages show the same background image properly. I gather it's getting overridden somewhere, but not sure where. v 1.3.9h

i.e the body background image

body {
background: url("../images/background2.jpg") repeat scroll 0 0 transparent;
margin: 0;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 62.5%;
color: #000000;
/* background-color: #FFFFFF; #F1F3E9; #172317; #031903; #000000; #F1F3E9; #e5edf5; */
}

background: url("../images/background2.jpg") repeat scroll 0 0 transparent;

Should be

background: url('../images/background2.jpg') repeat scroll 0 0 transparent;

And the image is to be in your template image folder

2 Dec 2011, 1:51 AM
#5
rescoccc avatar

rescoccc

Totally Zenned

Join Date:
May 2010
Location:
WA State
Posts:
1,700
Plugin Contributions:
2

Re: Background image not showng on main page

usernamenone:

background: url("../images/background2.jpg") repeat scroll 0 0 transparent;

Should be

background: url('../images/background2.jpg') repeat scroll 0 0 transparent;

And the image is to be in your template image folder

It'll work with either, or neither.

2 Dec 2011, 3:26 AM
#7
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Background image not showng on main page

Hi folks, thanks for the advice. I have since progressed a step further toward the cause. I tested the same template on a test shopping site and the same problem did not occur. I repeat, the problem did not occur. Thus the background image was displayed properly on the main page.

Thus this tells me that the stylesheet is not the cause of the problem, as it forms part of the template folder and I'm using exactly the same template folder on this test site. Thus the problems cause must lie elsewhere. The bug net gets smaller, but still yet to catch the bug. It might be one of the override files under the languages folder, as I have not copied these across to the test site, so I think step by step trial and error might bring me closer to the cause.

Will let you know what I find.

2 Dec 2011, 3:38 AM
#8
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Background image not showng on main page

Update. I've narrowed it down to the html_includes folder. i.e. when I copied the custom template folder under the html_includes folder to the test site, the same problem appeared. i.e. no background image on the main page, but was visible on other pages. Looking into it further.

2 Dec 2011, 3:52 AM
#9
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Background image not showng on main page

The problem appears to be in the custom define_main_page.php file.

2 Dec 2011, 4:17 AM
#10
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Background image not showng on main page

OK I deconstructed define_main_page.php on the test site and by breaking it down and removnig chunks at a time, then updating the test site and and refreshing the main page, I identified the following offending line.

body {background:#fff; margin:0; padding:15; font-size: 67%;}

2 Dec 2011, 4:20 AM
#11
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Background image not showng on main page

From the line **body {background:#fff; margin:0; padding:15; font-size: 67%;} ** in define_main_page.php

I have removed this part **background:#fff; ** which seems to have fixed the problem.

Thus I gather define_main_page.php overrides the stylesheet.css file.

2 Dec 2011, 4:51 AM
#12
gjh42 avatar

gjh42

Black Belt

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

Re: Background image not showng on main page

Actually, style rules have no proper place in PHP files, in most cases (with exceptions where only dynamic code can set the correct width etc.)
Move your style rules to the stylesheet, or to a new stylesheet named index_home.css if the rules would conflict with other pages' styling.

Any inline styles will override remote stylesheets unless the stylesheet has !important added to the property value.

5 Dec 2011, 12:37 PM
#13
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Background image not showng on main page

Fair enough. This style code was from a slide show application I installed. Anyway I've removed it and it does not cause a problem without it. Slide Show still works fine.