Forums / General Questions / show sidebox on pages other than homepage

show sidebox on pages other than homepage

Locked

Views: 875

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
25 Nov 2009, 12:08 AM
#1
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

show sidebox on pages other than homepage

Hi I tried following this tutorial but doing it in reverse to show a sidebox on everything other than my homepage. But it doesn't seem to work.
https://www.zen-cart.com/tutorials/index.php?article=270

I tried it with the blank sidebox module here
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=174

the module works find as it is when I download it.

the code of the default blank_sidebox.php is

<?php
/**
 * blank sidebox - allows a blank sidebox to be added to your site
 *
 * @package templateSystem
 * @copyright 2007 Kuroi Web Design
  * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
 */

  // test if box should display
  $show_blank_sidebox = true;

  if ($show_blank_sidebox == true) {
      require($template->get_template_dir('tpl_blank_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox.php');
      $title =  BOX_HEADING_BLANK_SIDEBOX;
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
 }
?>

I tried to alter it following the tutorial to this

<?php
/**
 * blank sidebox - allows a blank sidebox to be added to your site
 *
 * @package templateSystem
 * @copyright 2007 Kuroi Web Design
  * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
 */

  // test if box should display
  if ($this_is_home_page) {
    $show_blank_sidebox == false;
  } else {
    $show_blank_sidebox == true;
  }

  if ($show_blank_sidebox == true) {
      require($template->get_template_dir('tpl_blank_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox.php');
      $title =  BOX_HEADING_BLANK_SIDEBOX;
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
 }
?>

Can anyone tell me what I did wrong?

25 Nov 2009, 1:00 AM
#2
ajeh avatar

ajeh

Oba-san

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

Re: show sidebox on pages other than homepage

The way this is written:

  // test if box should display
  if ($this_is_home_page) {
// I am on the home page
    $show_blank_sidebox == false;
// false meanse do not show
  } else {
// I am not on the home page
    $show_blank_sidebox == true;
// true means show it
  }

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!

25 Nov 2009, 1:10 AM
#3
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: show sidebox on pages other than homepage

Yes I wanted to show it on pages that are not the homepage?

I admit I know nothing at all about php, just thought it seemed logical.

25 Nov 2009, 1:40 AM
#4
ajeh avatar

ajeh

Oba-san

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

Re: show sidebox on pages other than homepage

IF you set it to false for when $this_is_home_page is true then it will not show on the Home page ...

Make sure that you are uploading the file to the right directory after making your changes ... :smile:

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!

25 Nov 2009, 10:39 AM
#5
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: show sidebox on pages other than homepage

So the code above is right for what I want it to do and should work?

Thanks for your help.

25 Nov 2009, 11:03 AM
#6
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: show sidebox on pages other than homepage

Here's how it's done for the Categories box. You should be able to adapt it to other sideboxes.

http://www.zen-cart.com/forum/showthread.php?t=121318

Compare it to the stock categories box code to see what's been added.

Mostly, you're just wrapping the sidebox code in an "if - else" statement.

25 Nov 2009, 3:10 PM
#7
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: show sidebox on pages other than homepage

Thanks, I got it to work with this. Altough I still don't understand why the first one didn't work.

<?php
/**
 * blank sidebox - allows a blank sidebox to be added to your site
 *
 * @package templateSystem
 * @copyright 2007 Kuroi Web Design
  * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
 * @license [url]http://www.zen-cart.com/license/2_0.txt[/url] GNU Public License V2.0
 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
 */

  // test if box should display
  if ($this_is_home_page) {
    $show_blank_sidebox == false;
  } else {
      require($template->get_template_dir('tpl_blank_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox.php');
      $title =  BOX_HEADING_BLANK_SIDEBOX;
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
 }
?>