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 61 to 66 of 66
4 Jan 2011, 12:59 AM
#61
finlander avatar

finlander

Zen Follower

Join Date:
Oct 2010
Location:
Idaho
Posts:
293
Plugin Contributions:
0

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

Maybe I'm a moron, but I can't simply get a banner to display at all. The following things are all in place and nothing shows.

  1. My code (below) is from a 12leaves template and it appears in tpl_index_default.php in the centerbox area (just above boxes for New and Featured, etc., and just beneath all header and header navigation code).

  2. In Tools >> Banner Manager, I uploaded an image and put it in a new banner group which I named freeship.

  3. In Config >> Layout Settings, I put the group name 'freeship' in all of the locations to try to get it display, but it doesn't show up anywhere.

What am I missing?

<?php if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2)) { if ($banner->RecordCount() > 0) { ?> <div id="bannerTwo" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?>
4 Jan 2011, 1:09 AM
#62
finlander avatar

finlander

Zen Follower

Join Date:
Oct 2010
Location:
Idaho
Posts:
293
Plugin Contributions:
0

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

I may have answered my own question.

I currently have home page opening to top-level cats, so I would need to put the code for <!-- Home page banner 2 --> in tpl_index_categories, not tpl_index_default.

I suppose that then I could use $this_is_home_page code to only show banner on home page.

18 Sep 2011, 5:43 AM
#63
sph avatar

sph

Totally Zenned

Join Date:
Jan 2006
Posts:
1,556
Plugin Contributions:
0

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

Hi, trying to get a banner to appear on homepage only. Banner group set 4, what we call the footer1 banner immediately under products, etc.

Solution post 19 did not work. Gives blank page on homepage. Didn't try other pages.

Link to site:

http://www.findmypromdress.com/

Banner currently holds the Youtube link.

zc 1.3.9h

Thanks for any help.

sph
http://www.prommart.com/
http://www.fashion-mart.biz/

Steve
prommart.com

18 Sep 2011, 1:28 PM
#64
ajeh avatar

ajeh

Oba-san

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

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

You should be able to use:

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

If you then are getting a blank page, check that you do not have space(s) or blank line(s) after the closing php ?> at the end of the file ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Sep 2011, 7:47 PM
#65
sph avatar

sph

Totally Zenned

Join Date:
Jan 2006
Posts:
1,556
Plugin Contributions:
0

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

Thanks. I had the code correct. I just discovered that when editing, the code becomes all jumbled-up, causing failure. This often happens lately, with code getting jumbled up when editing. Sometimes it still works; others not.

sph

Steve
prommart.com

9 Mar 2012, 5:04 PM
#66
oustin avatar

oustin

New Zenner

Join Date:
Dec 2008
Posts:
3
Plugin Contributions:
0

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

kuroi:

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"; } } ?>

Thanks Kuroi it's working perfect!