Forums / Basic Configuration / How do i make banner ads appear on the front page only?

How do i make banner ads appear on the front page only?

Views: 28,387

Results 21 to 40 of 66
2 Aug 2007, 7:20 AM
#21
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

How do i make banner ads appear on the front page only?

aggiesoap:

I've been following this thread as I want a banner only on the main page. I tried both changes that have been suggested, however the banner still shows on all pages. Is there something small I have overlooked? Another setting somewhere? I have the banner turned on in banner manager and all banners OFF in layout box controller.The most likely reasons are that you have targeted the change to the wrong banner (i.e. not the one that you are using) or have put the change in code code, but in your template have over-ridden the file where you made the change.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

2 Aug 2007, 7:58 AM
#22
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: How do i make banner ads appear on the front page only?

To hopefully illuminate this issue rather than confuse it. Here is some code that I am currently using to create a banner cluster on the home page of a client's site.

I have brought together code for the first three banners, simplified it and wrapped a home page condition around it.```php

<?php if ($this_is_home_page) { if (SHOW_BANNERS_GROUP_SET1 != '' && ($banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) && $banner->RecordCount() > 0) { echo '<div id="bannerOne" class="banners">' . zen_display_banner('static', $banner) . '</div>' . "\n"; } if (SHOW_BANNERS_GROUP_SET2 != '' && ($banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2)) && $banner->RecordCount() > 0) { echo '<div id="bannerTwo" class="banners">' . zen_display_banner('static', $banner) . '</div>' . "\n"; } if (SHOW_BANNERS_GROUP_SET3 != '' && ($banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) && $banner->RecordCount() > 0) { echo '<div id="bannerThree" class="banners">' . zen_display_banner('static', $banner) . '</div>' . "\n"; } } ?>

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

2 Aug 2007, 9:16 AM
#23
mjw2305 avatar

mjw2305

New Zenner

Join Date:
Jul 2007
Posts:
17
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

Kuroi,

I will try your preffered method when i get home and can access my files properly; i am now using an over-ride file, not the template_default file, there is certainly some enlightening information here for me to try out.

Many Thanks, i will post again when i have got it working or not whatever the case maybe.

Regards

Mat

2 Aug 2007, 5:37 PM
#24
mjw2305 avatar

mjw2305

New Zenner

Join Date:
Jul 2007
Posts:
17
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

Thanks Kuroi, both fixes work a treat; but i have stuck with your preferred version

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

Many Thanks, i'm happy again at last lol

7 Oct 2007, 5:00 PM
#25
funkmanusa avatar

funkmanusa

New Zenner

Join Date:
Sep 2007
Posts:
38
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

I am having a hard time to make this function work. Previously I had added
a line to the stylesheet.css to call for the header image for the #logoWrapper{.
After reviewing the default template, maybe removing might solve some of my problem? heres the code in the css i have:```
#headerWrapper, #contentMainWrapper, #logoWrapper, #cartBoxListWrapper, #ezPageBoxList, #cartBoxListWrapper ul, #ezPageBoxList ul, #mainWrapper, #popupAdditionalImage, #popupImage {
margin: 0em;
padding: 0em;
}

#logoWrapper{
background-image: url(../images/header_bg.jpg);
background-repeat: repeat-x;
background-color: #ffffff;
height:170px;
}



On my tpl_header file I changed the line as desrcibed heres what I have:
<?php if (HEADER_SALES_TEXT != '' || (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2))) { ?> <?php if (HEADER_SALES_TEXT != '') { ?>
  <?php
          }

?>
<?php
if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2) && $this_is_home_page) {

            if ($banner->RecordCount() > 0) {

?>
<span class="banners"><?php echo zen_display_banner('static', $banner);?>
<?php } } ?>
<?php } // no HEADER_SALES_TEXT or SHOW_BANNERS_GROUP_SET2 ?>


And on my tpl_main_page it doesnt mention set2 at all, heres what I have:

$header_template = 'tpl_header.php';
$footer_template = 'tpl_footer.php';
$left_column_file = 'column_left.php';
$right_column_file = 'column_right.php';
$body_id = ($this_is_home_page) ? 'indexHome' : str_replace('_', '', $_GET['main_page']);
?>

<body id="<?php echo $body_id . 'Body'; ?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>> <?php if (SHOW_BANNERS_GROUP_SET1 != '' && $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 } } ?> ```

Any help figuring out why Im not successful getting this to work would be greatly appreciated!

Heres a link the to site in progress...
http://www.citysatchel.com/zen-cart/index.php?main_page=index

My eyes are swimming....all I'm trying to do is have a different banner on the home page than the other pages....:frusty:

7 Oct 2007, 5:49 PM
#26
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: How do i make banner ads appear on the front page only?

Re-read post 19 above. Also, I had relocated some of the banners in the code that I quoted above in order to place them where my client needed them, so your code will be a little different.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

17 Dec 2007, 3:50 AM
#27
stuff4toys avatar

stuff4toys

Totally Zenned

Join Date:
May 2007
Location:
SW Florida
Posts:
1,062
Plugin Contributions:
1

Re: How do i make banner ads appear on the front page only?

This one did it for me THANKS
JOhn ><>

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

Newest Site: ChargerPros - Stuff4Toys

23 Dec 2007, 11:53 PM
#28
thewetfish avatar

thewetfish

New Zenner

Join Date:
May 2006
Location:
Wisconsin
Posts:
48
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

Thanks for the help. This code achieved what I wanted as well.

27 Dec 2007, 3:16 AM
#29
matt123 avatar

matt123

New Zenner

Join Date:
Nov 2007
Posts:
46
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

Anyone care to show how to apply this to hiding the sidebox banner on the product page?

what do I load in place of is_home?

thanks!

27 Dec 2007, 10:33 AM
#30
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: How do i make banner ads appear on the front page only?

matt123:

Anyone care to show how to apply this to hiding the sidebox banner on the product page?

what do I load in place of is_home?You don't use this approach. Sideboxes are handled differently.

Instead therefore, you would use the approach explained in this FAQ entry (though you'd be tweaking the if statement already there) and use the condition $_GET['page'] == 'products_info'

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

28 Dec 2007, 3:03 AM
#31
matt123 avatar

matt123

New Zenner

Join Date:
Nov 2007
Posts:
46
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

Not all too familiar with php. While trying to adapt the code from the FAQ I either get no sidebar banner box on any page or on every page.

The code in banner_box is a bit different than the example. I've spent an hour or so trying different combinations and modifications to get it to work. (can you say php tarded?).

I'd really appreciate if someone could help clarify making the changes to the sidebox.

28 Dec 2007, 1:35 PM
#32
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: How do i make banner ads appear on the front page only?

Probably my fault. I should have said $_GET['main_page'] == 'products_info'

Apologies

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

28 Dec 2007, 9:03 PM
#33
matt123 avatar

matt123

New Zenner

Join Date:
Nov 2007
Posts:
46
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

Still no dice. The code is a little different on the banner_box than the featured_products. Can you look at the changes I have made and tell me where I've screwed up.

if ($_GET['main_page'] == 'products_info') {
$show_featured = true;
} else {
$show_featured = false;
} if (SHOW_BANNERS_GROUP_SET7 == '') {
$show_banner_box = false;
}

if ($show_banner_box == true) {
$banner_box[] = TEXT_BANNER_BOX;
$banner_box_group= SHOW_BANNERS_GROUP_SET7;

Thanks for the help!

28 Dec 2007, 9:36 PM
#34
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: How do i make banner ads appear on the front page only?

Too much Xmas spirit :blush: ... try $_GET['main_page'] == 'product_info'

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

3 Jan 2008, 12:56 AM
#35
matt123 avatar

matt123

New Zenner

Join Date:
Nov 2007
Posts:
46
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

I must be missing something or it's that Christmas spirits??

Too much Xmas spirit ... try $_GET['main_page'] == 'product_info'

Thats what I have....anyone know what I am doing wrong??

-Matt

4 Jan 2008, 7:52 AM
#36
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: How do i make banner ads appear on the front page only?

matt123:

Thats what I have....anyone know what I am doing wrong??It's not what you posted above which was "products_info" rather than "product_info".

A link to your site and the code that you are currently using if it's not what you posted above would be helpful.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

19 Oct 2008, 8:17 PM
#37
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: How do i make banner ads appear on the front page only?

kuroi:

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

> ```
if (SHOW_BANNERS_GROUP_SET3 != '' && $this_is_home_page && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) { 
```But it should still be done in an over-ride file and not the template_default version.


My apologies for bumping this old post, but after POURING over this forum, this is the CLOSEST I've gotten to my answer..

I am trying to find the OPPOSITE solution.. I want to NOT display the Banner 3 Group on the main page.. I tried using Kuroi's code above with a slight modification (it was a GUESS I admit:lookaroun)..

if (SHOW_BANNERS_GROUP_SET3 != '' && $this_is_[B]not[/B]_home_page && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {


Link: <http://clients.overthehillweb.com/he101/>

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

19 Oct 2008, 8:48 PM
#38
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: How do i make banner ads appear on the front page only?

DivaVocals:

I am trying to find the OPPOSITE solution.. I want to NOT display the Banner 3 Group on the main page.The is no varaible named $this_is_not_home_page. The code you need is:

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

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

19 Oct 2008, 11:45 PM
#39
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: How do i make banner ads appear on the front page only?

kuroi:

The is no varaible named $this_is_not_home_page.Well I told you it was a guess..:laugh::blush::laugh:

kuroi:

The code you need is:

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

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

8 Feb 2009, 7:49 PM
#40
myworld20091 avatar

myworld20091

New Zenner

Join Date:
Oct 2008
Posts:
85
Plugin Contributions:
0

Re: How do i make banner ads appear on the front page only?

kuroi:

The code you need is:

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


hi, i want BANNERS_GROUP_SET3 only showing on product page, product list page, and specials page, how do i modify the codes ?