Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Banner on Main Page Only

Banner on Main Page Only

Locked

Views: 4,943

Results 1 to 20 of 27
This thread is locked. New replies are disabled.
10 May 2007, 4:57 PM
#1
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Banner on Main Page Only

I've searched through the forums and found alot of threads related to this, but I'm a bit new to coding still and so I need a more thorough step by step explanation, if someone would be so kind...

https://www.RickRushArt.com

As you can see, the logo banner (Banner #3, I believe) is below the breadcrumb and above the Products... this is exactly how we want it, but we only want the banner to display on this main page.

If someone would be so kind as to provide a really definitive explanation to how to make this happen, I think it'd be helpful to a lot of people.

Thanks,

Brad

10 May 2007, 5:40 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,606
Plugin Contributions:
0

Re: Banner on Main Page Only

Open your tpl_main_page.php

Copy the code for banner box #3

Delete that code from tpl_main_page

Paste the code you copied into tpl_index_default.php

make sure you are using the Overrides.

10 May 2007, 6:02 PM
#3
kuroi avatar

kuroi

Totally Zenned

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

Re: Banner on Main Page Only

Or to avoid changing code at all, just put the image into your define_main_page.php file and it will only show up on the front page.

10 May 2007, 6:58 PM
#4
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

Open your tpl_main_page.php

Got it.

Copy the code for banner box #3

Where does the code begin and end?

Paste the code you copied into tpl_index_default.php

Where do I paste it? Which line, I mean?

make sure you are using the Overrides.

What are the Overrides?

10 May 2007, 8:11 PM
#5
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,606
Plugin Contributions:
0

Re: Banner on Main Page Only

What are the Overrides?

Start with this section of the FAQ's - https://www.zen-cart.com/tutorials/index.php?category=4

10 May 2007, 9:03 PM
#6
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

Thanks for your patience with me thus far. I'm pretty sure I'm using an over-ride, as I have a custom folder where all of the module/template folders are located... Hopefully I'll be fine with the next Zen update.

11 May 2007, 1:37 PM
#7
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

I'd still like to know on which lines the codes begin and end, and which lines I need to paste the codes in between...

11 May 2007, 2:00 PM
#8
kuroi avatar

kuroi

Totally Zenned

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

Re: Banner on Main Page Only

If you want to do this by programming, then this is the block of code in tpl_main_page.php that you would move. If you're using Zen Cart 1.3.7, then you will find it at line 100.

<?php
  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
    }
  }
?>
```Where you insert it in tpl)index_default.php depends upon which other features of that page you might wish to use now or later and where you would wish this to sit relative to them. Assuming that you want it to be at or near the top, then I would suggest after line 17 and before line 47, taking care not to pop it in the middle of any of the block of code that inhabit this range of lines.
14 May 2007, 3:09 PM
#9
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

Okay, I've removed the code from tpl_main_page and tried pasting it into a range of lines in the tpl_index_default, but the banner won't show up anywhere... I've made sure that I've actually got the banner turned on to begin with, and it is - so I'm sort of at a loss.

14 May 2007, 3:42 PM
#10
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,606
Plugin Contributions:
0

Re: Banner on Main Page Only

Perhaps paste the section of the file where you are pasting the code? (along with a few lines on either side?

14 May 2007, 3:52 PM
#11
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

I should have done that to begin with, sorry. Here we go...

tpl_index_default.php

<!-- deprecated - to use uncomment this section
<?php if (TEXT_MAIN) { ?>
<div id="" class="content"><?php echo TEXT_MAIN; ?></div>
<?php } ?>-->


<?php
  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
    }
  }
?>

<!-- deprecated - to use uncomment this section
<?php if (TEXT_INFORMATION) { ?>
<div id="" class="content"><?php echo TEXT_INFORMATION; ?></div>
<?php } ?>-->
14 May 2007, 11:24 PM
#12
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,606
Plugin Contributions:
0

Re: Banner on Main Page Only

What banner group do you have your banner in? Do you have that group activated for the Header position 3?

15 May 2007, 12:02 PM
#13
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

The Banner has a custom group name, "PreOrder", but in the Config>Layout Settings I put "PreOrder" in the Banner Display Groups - Header Position 3... If the name needs to be something else in order for this to work, that's an easy fix!

15 May 2007, 3:34 PM
#14
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,606
Plugin Contributions:
0

Re: Banner on Main Page Only

Make sure you haven't spelled the group name differently in the Banner manager and that the banner is active.

Oh- also make sure your browser doesn't have ads blocked.

15 May 2007, 5:00 PM
#15
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

Everything looks okay in the banner manager, and the banner showed up on all of the pages before I took the code out of tpl_main_page... does the code (pasted above and into the tpl_index_default) need to have the words "PreOrder" in it, if that's what the banner group is called?

I am so absolutely lost here, I don't know what to do.

Again and again, thanks for continuing to help me try and solve this problem.

16 May 2007, 3:24 PM
#16
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

Taking a deep breath and trying to replay my steps...

First, I went to :
**
/includes/templates/template_default/common/tpl_main_page.php**

and cut this code out,

<?php
  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
    }
  }
?> 

and then pasted that code into

**
/includes/templates/template_default/templates/tpl_index_default.php**

16 May 2007, 3:28 PM
#17
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

Instead of editing the files in template_default, should I have copied **tpl_main_page.php **and tpl_index_default.php to my template folder (rickrushart) and edited them in ***that ***common folder?

16 May 2007, 3:46 PM
#18
kuroi avatar

kuroi

Totally Zenned

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

Re: Banner on Main Page Only

Yes. I was about to post that but you were a step ahead of me - a good sign!

If you already have a tpl_main_page.php in that directory, your latest changes would be being over-ridden.

16 May 2007, 4:14 PM
#19
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,606
Plugin Contributions:
0

Re: Banner on Main Page Only

Instead of editing the files in template_default, should I have copied tpl_main_page.php and tpl_index_default.php to my template folder (rickrushart) and edited them in that common folder?

Sorry - I made the assumption that you would put the edited files in your override directories.

16 May 2007, 5:59 PM
#20
bradsmith avatar

bradsmith

New Zenner

Join Date:
Jan 2007
Posts:
50
Plugin Contributions:
0

Re: Banner on Main Page Only

Kim:

Sorry - I made the assumption that you would put the edited files in your override directories.

Sorry, very obviously I thought I was using the override directory. I hope you aren't getting overly frustraited with me, as I'm really trying, here.

So, just to update the continuing chronicle that is my Banner on Main Page Only thread... I have taken the edited

includes/templates/template_default/templates/tpl_index_default.php

and moved it to the appropriate...

includes/templates/rickrushart/templates/tpl_index_default.php

next, I took the NON-EDITED

/includes/templates/template_default/common/tpl_main_page.php

and moved it to...

includes/templates/rickrushart/common/tpl_main_page.php

The result is that the banner now shows up on all pages - so, presumably, all I have to do is edit the banner code out of the tpl_main_page.php file again, right? Let's see!