Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / help removing slider banner from every page except home page

help removing slider banner from every page except home page

Views: 3,745

Results 1 to 17 of 17
12 Mar 2013, 10:46 AM
#1
johnnycopilot avatar

johnnycopilot

Zen Follower

Join Date:
Mar 2012
Posts:
325
Plugin Contributions:
0

help removing slider banner from every page except home page

I only want the slider to be on home page. Slider uses Banners Header Position 1, 2 and 3 for the slide images. I really wanted to figure this out by myself, but I don't think that's going to happen. I removed some slider code from the template file '/common/tpl_main_page.php' but that removed the slider from every page, including the home page, so I put the original back.:blush: There aren't very many pages to this template, so if someone could steer me in the right direction, I certainly don't mind going to each page and looking for what I need to look for. I looked in other pages, such as tpl_contact_us_default.php, tpl_modules_main_product_image.php, tpl_shopping_cart.php, etc,, but didn't see any similar code.

Oh, sorry, I am using Zen V1.51, and I am talking about Alien Stemware Template. Template is for Zen v1.3.9 but the files from template only go in their own folder in includes/templates/alien-stemware. Since no system files overwritten I tried it and it seem to be working fine. It has a JS file with the settings (speed, etc) for the slider as well. The website is https://www.long-skateboards.com ... Any help, as usual, would be GREEEEEEATLY appreciated. thanks! :smile:

12 Mar 2013, 5:53 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: help removing slider banner from every page except home page

Hopefully you still have that edited file tpl_main_page.php

Create a folder in your custom template named "index"

Place the file that currently exists in common into the index folder

Upload your edited file to the common folder

12 Mar 2013, 11:01 PM
#3
johnnycopilot avatar

johnnycopilot

Zen Follower

Join Date:
Mar 2012
Posts:
325
Plugin Contributions:
0

Re: help removing slider banner from every page except home page

Thanks Kobra, that ALMOST got it. Let me explain. Banner is gone from all non-home pages including contact, specials, etc. except any category that has more than 1 product. If category has only one product, banner is gone; if category has more than one product, banner shows back up. The code that I removed from the tpl_main_page.php was from line 96-151 and is in red. Did I start/stop at the correct place? ps. I added some categories if you need to take a look at it.. I tried pretty much every variation of removing code that I could come up with including changing that "(1)" to different numbers, but whatever I did usually just made the website pretty much disappear.. ha

<?php /** * Common Template - tpl_main_page.php * * Governs the overall layout of an entire page<br /> * Normally consisting of a header, left side column. center column. right side column and footer<br /> * For customizing, this file can be copied to /templates/your_template_dir/pagename<br /> * example: to override the privacy page<br /> * - make a directory /templates/my_template/privacy<br /> * - copy /templates/templates_defaults/common/tpl_main_page.php to /templates/my_template/privacy/tpl_main_page.php<br /> * <br /> * to override the global settings and turn off columns un-comment the lines below for the correct column to turn off<br /> * to turn off the header and/or footer uncomment the lines below<br /> * Note: header can be disabled in the tpl_header.php<br /> * Note: footer can be disabled in the tpl_footer.php<br /> * <br /> * $flag_disable_header = true;<br /> * $flag_disable_left = true;<br /> * $flag_disable_right = true;<br /> * $flag_disable_footer = true;<br /> * <br /> * // example to not display right column on main page when Always Show Categories is OFF<br /> * <br /> * if ($current_page_base == 'index' and $cPath == '') {<br /> * $flag_disable_right = true;<br /> * }<br /> * <br /> * example to not display right column on main page when Always Show Categories is ON and set to categories_id 3<br /> * <br /> * if ($current_page_base == 'index' and $cPath == '' or $cPath == '3') {<br /> * $flag_disable_right = true;<br /> * }<br /> * * @package templateSystem * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_main_page.php 7085 2007-09-22 04:56:31Z ajeh $ */ // the following IF statement can be duplicated/modified as needed to set additional flags if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) { $flag_disable_right = true; } $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.'"'; ?>> <div id="mainWrapper"> <?php /** * prepares and displays header output * */ if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == '')) { $flag_disable_header = true; } require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');?> <table width="100%" border="0" cellspacing="0" cellpadding="0" id="contentMainWrapper"> <tr> <?php if (COLUMN_LEFT_STATUS == 0 || (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '') || (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_COLUMN_LEFT_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == ''))) { // global disable of column_left $flag_disable_left = true; } if (!isset($flag_disable_left) || !$flag_disable_left) { ?> <td id="navColumnOne" class="columnLeft" style="width: <?php echo COLUMN_WIDTH_LEFT; ?>"> <?php /** * prepares and displays left column sideboxes * */ ?> <div id="navColumnOneWrapper" style="width: <?php echo BOX_WIDTH_LEFT; ?>"><?php require(DIR_WS_MODULES . zen_get_module_directory('column_left.php')); ?></div></td> <?php } ?> <td valign="top"> <?php if(1){ ?>

<div class="banners">

<div id="loopedSlider"> <div class="container"> <div class="slides"> <!-- BOF- BANNER #2 display --> <?php if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) { if ($banner->RecordCount() > 0) { ?> <div id="bannerOne"><?php echo zen_display_banner('static', $banner);?></div> <?php } } ?> <!-- EOF- BANNER #2 display --> <!-- BOF- BANNER #3 display --> <?php if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2)) { if ($banner->RecordCount() > 0) { ?> <div id="bannerTwo"><?php echo zen_display_banner('static', $banner);?></div> <?php } } ?> <!-- EOF- BANNER #3 display --> <!-- BOF- BANNER #4 display --> <?php if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) { if ($banner->RecordCount() > 0) { ?> <div id="bannerThree"><?php echo zen_display_banner('static', $banner);?></div> <?php } } ?> <!-- EOF- BANNER #4 display --> <!-- BOF- BANNER #4 display --> <?php if (SHOW_BANNERS_GROUP_SET4 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET4)) { if ($banner->RecordCount() > 0) { ?> <div id="bannerFour"><?php echo zen_display_banner('static', $banner);?></div> <?php } } ?> <!-- EOF- BANNER #4 display --> </div> </div> <a href="#" class="previous"> </a> <a href="#" class="next"> </a> </div> </div> <?php } ?>

<!-- bof breadcrumb --> <?php if (DEFINE_BREADCRUMB_STATUS == '1' || (DEFINE_BREADCRUMB_STATUS == '2' && !$this_is_home_page) ) { ?>
<div id="navBreadCrumb"><?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div>
<?php } ?>

<!-- eof breadcrumb -->

<!-- bof upload alerts -->

<?php if ($messageStack->size('upload') > 0) echo $messageStack->output('upload'); ?>

<!-- eof upload alerts -->

<?php /** * prepares and displays center column * */ require($body_code); ?> <?php if (SHOW_BANNERS_GROUP_SET4 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET4)) { if ($banner->RecordCount() > 0) { ?> <div id="bannerFour" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?></td> <?php //if (COLUMN_RIGHT_STATUS == 0 || (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '') || (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_COLUMN_RIGHT_OFF == 'true' && $_SESSION['customers_authorization'] != 0)) { if (COLUMN_RIGHT_STATUS == 0 || (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '') || (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_COLUMN_RIGHT_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == ''))) { // global disable of column_right $flag_disable_right = true; } if (!isset($flag_disable_right) || !$flag_disable_right) { ?> <td id="navColumnTwo" class="columnRight" style="width: <?php echo COLUMN_WIDTH_RIGHT; ?>"> <?php /** * prepares and displays right column sideboxes * */ ?> <div id="navColumnTwoWrapper" style="width: <?php echo BOX_WIDTH_RIGHT; ?>"><?php require(DIR_WS_MODULES . zen_get_module_directory('column_right.php')); ?></div></td> <?php } ?> </tr> </table> <?php /** * prepares and displays footer output * */ if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_FOOTER_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == '')) { $flag_disable_footer = true; } require($template->get_template_dir('tpl_footer.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_footer.php'); ?> </div> <!--bof- parse time display --> <?php if (DISPLAY_PAGE_PARSE_TIME == 'true') { ?> <div class="smallText center">Parse Time: <?php echo $parse_time; ?> - Number of Queries: <?php echo $db->queryCount(); ?> - Query Time: <?php echo $db->queryTime(); ?></div> <?php } ?> <!--eof- parse time 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 --> </body>
12 Mar 2013, 11:34 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: help removing slider banner from every page except home page

Maybe this would do what you want and no need for the file in the index folder

Just the part that you had in red with the addition of the if statement that I have highlighted

<?php
if (!$this_is_home_page) {
?>

<div class="banners">



<div id="loopedSlider">
<div class="container">
<div class="slides">
<!-- BOF- BANNER #2 display -->
<?php
if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerOne"><?php echo zen_display_banner('static', $banner);?></div>
<?php
}
}
?>
<!-- EOF- BANNER #2 display -->
<!-- BOF- BANNER #3 display -->
<?php
if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2)) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerTwo"><?php echo zen_display_banner('static', $banner);?></div>
<?php
}
}
?>
<!-- EOF- BANNER #3 display -->
<!-- BOF- BANNER #4 display -->
<?php
if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerThree"><?php echo zen_display_banner('static', $banner);?></div>
<?php
}
}
?>
<!-- EOF- BANNER #4 display -->
<!-- BOF- BANNER #4 display -->
<?php
if (SHOW_BANNERS_GROUP_SET4 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET4)) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerFour"><?php echo zen_display_banner('static', $banner);?></div>
<?php
}
}
?>
<!-- EOF- BANNER #4 display -->
</div>
</div>
<a href="#" class="previous"> </a>
<a href="#" class="next"> </a>
</div>


</div>
<?php
}
13 Mar 2013, 12:16 AM
#5
johnnycopilot avatar

johnnycopilot

Zen Follower

Join Date:
Mar 2012
Posts:
325
Plugin Contributions:
0

Re: help removing slider banner from every page except home page

Ok, I did that (remove index folder, add that line to common/tpl_main_page.php); it had the opposite effect. It made the banner disappear from the home page, and show up on every other page.. that's the way it is now if you need to take a look. Thanks!!!

13 Mar 2013, 12:27 AM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: help removing slider banner from every page except home page

Well this is supposed to work
try editing
if (!$this_is_home_page)
to
if ($this_is_home_page)

dropping the !

13 Mar 2013, 2:07 AM
#7
johnnycopilot avatar

johnnycopilot

Zen Follower

Join Date:
Mar 2012
Posts:
325
Plugin Contributions:
0

Re: help removing slider banner from every page except home page

Dropping the ! did it. From now on you will be referred to as King Kobra :flex:

13 Mar 2013, 2:15 AM
#8
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: help removing slider banner from every page except home page

Try setting your left column & box widths to 185px instead of 180px

13 Mar 2013, 2:36 AM
#9
johnnycopilot avatar

johnnycopilot

Zen Follower

Join Date:
Mar 2012
Posts:
325
Plugin Contributions:
0

Re: help removing slider banner from every page except home page

I already tried that, but 180 seems to be as wide as they will get. I actually need it slightly wider because some of my categories wrap when you do a mouse-over, and I don't like that (well, they DID wrap, but I shortened the name).. I tried 185, 200, 250, 300... but they stop at 180 (incidentally, that's where the install instructions say to set them 180, so I guess the template is limiting the width??? ).. What I was fixin' to try (also) is to widen the entire template out a little. I don't want the website width floating (if that's the correct word); I want it a fixed width, but I do want a little wider. In one of my other zen cart sites I changed width from fixed to a %; but don't want that with this template. I was going to go back and look at my notes to see where I made that change, and attempt it on this template. If you can direct me to where I can make the column width change I would really appreciate it. I think I can find how to change the entire website width..? maybe.. ha

13 Mar 2013, 2:57 AM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: help removing slider banner from every page except home page

First set your desired width in Cofiguration > Layout Settings > both
Column Width - Left
and
Column Width - Left - Boxes

You appear to have both of these set to 180px.

13 Mar 2013, 3:00 AM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: help removing slider banner from every page except home page

stylesheet.css (line 270) ```
#mainWrapper {
text-align: left;
vertical-align: top;
width: 980px;
}

Set width as desired.
13 Mar 2013, 3:04 AM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: help removing slider banner from every page except home page

stylesheet.css (line 29)```
#navColumnOne, #navColumnTwo {
background-color: transparent;
width: 180px !important;
}

13 Mar 2013, 3:10 AM
#13
johnnycopilot avatar

johnnycopilot

Zen Follower

Join Date:
Mar 2012
Posts:
325
Plugin Contributions:
0

Re: help removing slider banner from every page except home page

deleted this post because I didn't respond to the correct thing... sorry

13 Mar 2013, 3:13 AM
#14
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: help removing slider banner from every page except home page

Look at post #12 just before your latest.

13 Mar 2013, 3:17 AM
#15
johnnycopilot avatar

johnnycopilot

Zen Follower

Join Date:
Mar 2012
Posts:
325
Plugin Contributions:
0

Re: help removing slider banner from every page except home page

yea, sorry.. I clicked on my email message, it took me to page one of this post, I responded, looked at my response which showed up on page 2, and then saw your solutions... haha.. who's on first? Thanks gjh42, you guys and girls here are the best.. btw,, been to upstate NY many many times.... love it up there... I have noticed that New Yorkers call anything north of the big apple "upstate".. haha

13 Mar 2013, 5:17 AM
#16
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: help removing slider banner from every page except home page

That's because we really don't want to be confused with NYC or the metro area:)
Worlds apart...

13 Mar 2013, 7:42 AM
#17
johnnycopilot avatar

johnnycopilot

Zen Follower

Join Date:
Mar 2012
Posts:
325
Plugin Contributions:
0

Re: help removing slider banner from every page except home page

As far as NY, I definitely understand that!! I used to tour with a band that was based out of Brooklyn (I'm a soundman); I am from the country... that's why I would head upstate as soon and often as possible.. haha (though I do love food in the city).. plus there is a wonderful drop-zone in Gardiner... and always had a great time in Buffalo.. great people..

I finally got my website BANNER size and position, location etc., Site Width, Sideboxes, Font sizes, etc.. like I want, for the most part.. Thanks very much gjh42 and Kobra,,, um, I mean King Kobra. I REALLY appreciate the time that you guys spent helping me. Now if I can start selling some stuff. I am struggling with my websites for traffic.. but that's another post I am working on.. Like I said before, thanks!!