Zen Cart Logo
Forums / General Questions / Can I put some html content on the first page only?

Can I put some html content on the first page only?

Views: 1,999

Results 1 to 20 of 25
9 May 2013, 10:15 PM
#1
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Can I put some html content on the first page only?

How can you place html below the footer on the first page only?

10 May 2013, 5:04 PM
#2
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

Can the html be placed on the index.php page only, below the footer?

10 May 2013, 5:50 PM
#3
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Can I put some html content on the first page only?

yes by using banner manager in your admin area, just add your html to your banner and set where you'd like it to display. There's a thread or it may have been a FAQ page too of how to set it to show on homepage only.

10 May 2013, 6:22 PM
#4
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

picandnix:

yes by using banner manager in your admin area, just add your html to your banner and set where you'd like it to display. There's a thread or it may have been a FAQ page too of how to set it to show on homepage only.

Thank you for the reply.

That could work for me, if I could make appear on the index first page only.

10 May 2013, 6:49 PM
#5
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

I am revising the following in tpl_main_page.php

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

from Linda's (Ajeh) Post but I am still getting the banner on all pages, below the footer.

I am trying to make it show up on the first page / home page, below the footer only.

10 May 2013, 7:08 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: Can I put some html content on the first page only?

Try wrapping this logic in

if ($this_is_home_page) {
...

10 May 2013, 7:22 PM
#7
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

I tried

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

also tried

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

No luck.

10 May 2013, 8:56 PM
#8
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

I went a head and installed a fresh Zen 1.5.1 to test. I modified the following code at line 104 and I am getting the same results. Banner at position 3, below the footer, shows up on all pages.

includes/templates/classic/common/tpl_main_page.php

<?php
  if ($this_is_home_page && SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
    if ($banner->RecordCount() > 0) {
?>
<div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<?php
    }
  }
?>
10 May 2013, 9:19 PM
#9
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

I thought the images of admin might help
Attachment 12475
Attachment 12476

10 May 2013, 9:20 PM
#10
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Can I put some html content on the first page only?

wrong banner?

<?php
  if ($this_is_home_page && (SHOW_BANNERS_GROUP_SET4 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET4))) {
10 May 2013, 9:23 PM
#11
divavocals avatar

divavocals

Totally Zenned

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

Re: Can I put some html content on the first page only?

swguy:

Try wrapping this logic in

if ($this_is_home_page) {
...

The opening bracket is missing in your conditional statement..

Kevin205:

I tried

<?php if (($this_is_home_page) && SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) { if ($banner->RecordCount() > 0) { ?>
10 May 2013, 9:24 PM
#12
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

I am using banner 3 for.

What do you mean wrong banner?

10 May 2013, 9:29 PM
#13
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

DivaVocals:

The opening bracket is missing in your conditional statement..

Where would the } close?

10 May 2013, 9:38 PM
#14
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Can I put some html content on the first page only?

Kevin205:

I am using banner 3 for.

What do you mean wrong banner?

I meant different banner, but try the code I posted but for your chosen banner number of course.

10 May 2013, 9:48 PM
#15
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

picandnix:

I meant different banner, but try the code I posted but for your chosen banner number of course.

picandnix:

wrong banner?

<?php if ($this_is_home_page && (SHOW_BANNERS_GROUP_SET4 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET4))) { ``` I tried the following: ```php <?php if ($this_is_home_page && (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3))) { if ($banner->RecordCount() > 0) { ?> <div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?> ```

No it does not work. Thank you.

10 May 2013, 9:51 PM
#16
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

DivaVocals:

The opening bracket is missing in your conditional statement..

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

Unless, I have written it wrong, it is not good.

10 May 2013, 10:06 PM
#17
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

Attachment 12477

I just found out something, when I place the Wide-Banner to Header Position 3, and with the following code, it works.

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

Banner shows up in Header Position 3 on the index page and NOT on all other pages. (The code works)

But, the Footer Position 3 Wide-Banner shows up on all pages.

How is the footer section controlled?

10 May 2013, 10:20 PM
#18
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

Problem solved.

It is SHOW_BANNERS_GROUP_SET6 and not SHOW_BANNERS_GROUP_SET3

<!--bof- banner #6 display -->
<?php
if ($this_is_home_page) { 
  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 -->

It works fine now.

Thank you picandnix, swguy and DivaVocals.

10 May 2013, 10:31 PM
#19
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Can I put some html content on the first page only?

By the way Ajeh's and picandnix's original suggestion works fine also. The numbers got me confused. In the admin I think it should be called positions 1 through 6. But I am sure there are a lot of other things to consider!

<!--bof- banner #6 display -->
<?php
  if ($this_is_home_page && 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 -->

That was a nice 5 hours.

11 May 2013, 12:54 AM
#20
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Can I put some html content on the first page only?

Kevin205:

That was a nice 5 hours.

Well done :cheers: