Zen Cart Logo
Forums / Basic Configuration / Banners only on main page

Banners only on main page

Views: 11,824

Results 1 to 20 of 36
30 Sep 2009, 2:15 PM
#1
jemilie avatar

jemilie

New Zenner

Join Date:
Sep 2009
Posts:
3
Plugin Contributions:
0

Banners only on main page

I am also trying to make the banners only appear on the home page. I tried all of the suggestions offered in the previous posts, and I have not yet had any luck. The website is www.thestorehg.com

Thanks.

<!--bof- banners display --> <?php if (SHOW_BANNERS_GROUP_SET1 != '' &&($banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1))&&$this_is_the_home_page ){ if ($banner->RecordCount() > 0) { ?> <div id="bannerOne" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?> <!--eof banners display--> <!--bof- banner #6 display --> <?php if (SHOW_BANNERS_GROUP_SET6 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET6)) { if ($banner->RecordCount() > 0) { ?> <div id="bannerSix" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?> <!--eof- banner #6 display --> jemilie is offline Reply With Quote
30 Sep 2009, 3:10 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Banners only on main page

You are using:
$this_is_the_home_page

try using:
$this_is_home_page

There isn't a "the" in there ... :smile:

30 Sep 2009, 9:06 PM
#3
jemilie avatar

jemilie

New Zenner

Join Date:
Sep 2009
Posts:
3
Plugin Contributions:
0

Re: Banners only on main page

Thanks for catching the fact that I needed to remove 'the' from the code.

I have removed that, and continue to have no luck displaying the banners only on the home page.

So, I am looking at the name in the code:

if (SHOW_BANNERS_GROUP_SET1 != '' && $this_is_home_page && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
if ($banner->RecordCount() > 0) {
?>

<div id="bannerOne" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?> <!--eof banners display-->

I am looking at the names of my groups in the zen cart admin area, and this is what I see:

The names of my banners groups are header-banner, header-banner2, header-banner3 and header-banner4. The name of the div is BannerOne for all 4 banners when I look at the source code. If this is the case, how should I word my code in the tpl_main_page ?

Thanks,
Julia

1 Oct 2009, 4:15 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Banners only on main page

To only show on the home page, try this instead:

if ($this_is_home_page && (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1))) { 
21 Dec 2009, 8:45 AM
#5
jbcholdings avatar

jbcholdings

New Zenner

Join Date:
Jul 2009
Posts:
32
Plugin Contributions:
0

Re: Banners only on main page

Ajeh:

To only show on the home page, try this instead:

if ($this_is_home_page && (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1))) {


Tried this as well, and am having no luck?

Entered the code *exactly* as it was mentioned. Do I need to "name" my banner groups or anything in advance?
21 Dec 2009, 2:28 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Banners only on main page

Check if this is your template ...

The original file:
/includes/templates/templates_default/common/tpl_main_page.php

should be copied (if you already have one, then edit the file rather than copy the file over it) to your templates and overrides directory:
/includes/templates/your_template_dir/common/tpl_main_page.php

Make sure that you have defined a Banner for the Banner Group that you have setup in the Configuration ... Layout Settings ...

Banner Display Groups - Header Position 1
The Banner Display Groups can be from 1 Banner Group or Multiple Banner Groups

For Multiple Banner Groups enter the Banner Group Name separated by a colon :

Example: Wide-Banners:SideBox-Banners

What Banner Group(s) do you want to use in the Header Position 1?
Leave blank for none

And that you have added a Banner to that Banner Group ...

16 Mar 2011, 7:42 PM
#7
ddye avatar

ddye

New Zenner

Join Date:
Apr 2007
Posts:
43
Plugin Contributions:
0

Re: Banners only on main page

I am having the exact same problem. A client wants the banner only on the Main Page, but I'm such a WYSIWYG guy that I can't figure out the code.

In my case I have assigned Layout Settings/Banner Display Groups - Header Position 2 the value "top-banner". This is what is showing on all pages. So do I modify the tpl_main_page.php in templates/template_default/common, or in the template I am using?

Do I have to make any modifications to the code provided below?

if ($this_is_home_page && (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1))) {

Is "GROUP_SET1" the same as "Header Position 2" in the Layout Settings?

I am sooooooooo confused...

Thanks in advance!

16 Mar 2011, 7:59 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Banners only on main page

Header Position 2 used the code:
SHOW_BANNERS_GROUP_SET2

and you appear to be using:
SHOW_BANNERS_GROUP_SET1

16 Mar 2011, 8:03 PM
#9
ddye avatar

ddye

New Zenner

Join Date:
Apr 2007
Posts:
43
Plugin Contributions:
0

Re: Banners only on main page

Ajeh:

Header Position 2 used the code:
SHOW_BANNERS_GROUP_SET2

and you appear to be using:
SHOW_BANNERS_GROUP_SET1
Thanks. I had copied the code and changed the "1" to "2", with no results. I uploaded the modified file to both the template default and the template I'm using.

So "GROUP_SET1" the same as "Header Position 2"? Sorry for the lack of understanding, I can usually stumble around through code and eventually get it. Also, in the tpl_main_page.php, there is no GROUP_SET2, the code goes from 1 to 6...

If it helps at all, we're building the site here:

http://www.richmondmediatestserver2.info/

Not much is there yet, just getting attributes and other stuff together right now, so forgive the unfinished state of the site. I have a quick meeting, I'll check back afterwards. Thanks again!

Doug

16 Mar 2011, 8:07 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Banners only on main page

Do not change the code from 1 to 2 ...

Find the original code that uses:
SHOW_BANNERS_GROUP_SET2

and add your change to that so you are altering the Header Position 2 banner code and not the Header Position 1 banner code ...

17 Mar 2011, 5:15 PM
#11
ddye avatar

ddye

New Zenner

Join Date:
Apr 2007
Posts:
43
Plugin Contributions:
0

Re: Banners only on main page

Thanks, and sorry for the delay in replying. Is there another file that would contain the SHOW_BANNERS_GROUP_SET2 info? Because the tpl_main_page.php page skips from SET1 to SET 3...

The actual code around the banner is this:

<div id="headerpic"> <div id="bannerTwo" class="banners"><img src="images/04.jpg" alt="04" title=" 04 " width="960" height="274" /></div>

And the banner is definitely showing up on all pages, so the code HAS to be somewhere. It's not on the tpl_main_page.php page from either the template_default common folder or the template folder I am using.

Sorry for the lack of knowledge, it's very frustrating to look for code that isn't there...

Thanks again,

Doug

Ajeh:

Do not change the code from 1 to 2 ...

Find the original code that uses:
SHOW_BANNERS_GROUP_SET2

and add your change to that so you are altering the Header Position 2 banner code and not the Header Position 1 banner code ...

17 Mar 2011, 5:23 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Banners only on main page

Go to the Tools ... Developers Tool Kit ... and in the bottom input box enter:
SHOW_BANNERS_GROUP_SET2

and select Catalog ... and click Search ...

What files come up with that reference? :unsure:

17 Mar 2011, 6:21 PM
#13
ddye avatar

ddye

New Zenner

Join Date:
Apr 2007
Posts:
43
Plugin Contributions:
0

Re: Banners only on main page

Wow, I get:

Error: No matching Configuration Keys were found ... SHOW_BANNERS_GROUP_SET2

Again, the code says "bannerTwo"....

I will try to find the banner instrcutions I got from the template, I have files between my office and my home...

Doug

Ajeh:

Go to the Tools ... Developers Tool Kit ... and in the bottom input box enter:
SHOW_BANNERS_GROUP_SET2

and select Catalog ... and click Search ...

What files come up with that reference? :unsure:

17 Mar 2011, 6:45 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Banners only on main page

Are you saying when you search with the bottom input box for:
SHOW_BANNERS_GROUP_SET2

and select the Catalog that you do not see anything like:

/includes/templates/template_default/common/tpl_header.php

Line #71 : <?php if (HEADER_SALES_TEXT != '' || (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2))) { ?>

Line #81 : if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2)) {

Line #90 : <?php } // no HEADER_SALES_TEXT or SHOW_BANNERS_GROUP_SET2 ?>

17 Mar 2011, 7:06 PM
#15
ddye avatar

ddye

New Zenner

Join Date:
Apr 2007
Posts:
43
Plugin Contributions:
0

Re: Banners only on main page

Ajeh:

Are you saying when you search with the bottom input box for:
SHOW_BANNERS_GROUP_SET2

and select the Catalog that you do not see anything like:
Wow, sorry, I hadn't selected to search "All Files - Catalog", I'd left that blank.

I got two hits for tpl_header.php, not for tpl_main.php**. **

**/templates/premium2a/common/tpl_header.php

/templates/template_default/common/tpl_header.php
**
Which file should I make the changes in? As always, thanks a bunch.

Doug

17 Mar 2011, 8:24 PM
#16
ddye avatar

ddye

New Zenner

Join Date:
Apr 2007
Posts:
43
Plugin Contributions:
0

Re: Banners only on main page

I GOT IT!!!!!!!!

It was the tpl_header.php file! Thank you soooooooooo much!

Doug

17 Mar 2011, 9:11 PM
#17
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Banners only on main page

You are most welcome ... thanks for the update that you have this working and for posting where the solution to this problem was ... :smile:

23 Mar 2011, 5:17 PM
#18
gunni avatar

gunni

Zen Follower

Join Date:
Aug 2010
Location:
Israel
Posts:
287
Plugin Contributions:
0

Re: Banners only on main page

Hi.
Succeeded to make Banner three / Banner ads only in main page but I have a size problem with the width.
The banner is not looking good in 800px or 1200px.
Therfore I would like to make it repeated on the x but could not find where to add the repeat command.

24 Mar 2011, 11:00 AM
#19
e654777 avatar

e654777

New Zenner

Join Date:
Dec 2009
Posts:
5
Plugin Contributions:
0

Re: Banners only on main page

Yeah ... Got it change to display on only main page.
Thanks Ajeh. :smile:

24 Mar 2011, 1:15 PM
#20
gunni avatar

gunni

Zen Follower

Join Date:
Aug 2010
Location:
Israel
Posts:
287
Plugin Contributions:
0

Re: Banners only on main page

What about my question ? Banner width...