Forums / Basic Configuration / Show/Hide INformation Sidebox based on page

Show/Hide INformation Sidebox based on page

Views: 6,460

Results 1 to 13 of 13
15 Nov 2006, 3:50 PM
#1
atracksler avatar

atracksler

New Zenner

Join Date:
Jan 2006
Posts:
51
Plugin Contributions:
0

Show/Hide INformation Sidebox based on page

I would like to Hide the Information sidebox, except on:
index.php?main_page=page&id=2&chapter=0

How do I set up a conditional statement to check for this in information.php??

16 Nov 2006, 6:01 PM
#2
burtjesus avatar

burtjesus

New Zenner

Join Date:
Sep 2006
Posts:
32
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

I too am looking for this solution.

Any help would be greatly appreciated!! Thanks.


Steve

16 Nov 2006, 6:34 PM
#3
burtjesus avatar

burtjesus

New Zenner

Join Date:
Sep 2006
Posts:
32
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

Here is one way to do it; it may not be the best, but it appears to work.

If you put a conditional statement around the two requires at the bottom of information.php, then you can force it to display only on certain pages.

For example, in information.php there is:

require($template->get_template_dir('tpl_information.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_information.php');

$title = BOX_HEADING_INFORMATION;
$title_link = false;

require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);

if you wrap this with a conditional, such as:

if( $_GET['main_page'] == 'page' && $_GET['id'] == '2' && $_GET['chapter'] == '0') {

require($template->get_template_dir('tpl_information.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_information.php');

$title = BOX_HEADING_INFORMATION;
$title_link = false;

require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);

}

you should see the information box only on that specific ez page. It appears to work for me. I'm sure there are other variables that could be tested that may be more reliable. Anybody got ideas on how to improve this conditional?

Thanks,
Steve


Steve

8 Oct 2007, 4:43 PM
#4
dhcernese avatar

dhcernese

Zen Follower

Join Date:
Mar 2007
Location:
Pepperell, Massachusetts
Posts:
232
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

I cannot answer your question, but I'm also looking for a more generalized "conditional" sidebox. I've created by own sidebox which appears to work nicely. However, I don't want it shown all the time-- I have a variable I test. I can test for this inside the sidebox content, but that doesn't cover it's header.

Anyone have a more general place to conditionalize a sidebox visibility?

17 Oct 2007, 12:51 AM
#5
binary avatar

binary

New Zenner

Join Date:
Jul 2007
Posts:
8
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

dhcernese:

Anyone have a more general place to conditionalize a sidebox visibility?

I used the CSS solution suggested by gjh42 in a related thread:

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

Add the last box of code from post#2 to your stylesheet and edit as needed. Works great for me and is very easy to implement!

Lisa

25 Oct 2007, 3:19 PM
#6
dhcernese avatar

dhcernese

Zen Follower

Join Date:
Mar 2007
Location:
Pepperell, Massachusetts
Posts:
232
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

binary:

I used the CSS solution suggested by gjh42 in a related thread:

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

Add the last box of code from post#2 to your stylesheet and edit as needed. Works great for me and is very easy to implement!

LisaThank you for the pointer!

17 Apr 2010, 9:23 PM
#8
khopek avatar

khopek

Totally Zenned

Join Date:
Aug 2006
Location:
portlandish, oregon
Posts:
795
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

What would be the correct syntax to accomplish this for

/index.php?main_page=product_info&products_id=4

I need a couple sidebox NOT to show on this page. :D

18 Apr 2010, 12:21 AM
#9
gjh42 avatar

gjh42

Black Belt

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

Re: Show/Hide INformation Sidebox based on page

if (!($current_page_base == 'product_info' and $products_id == '4')) {

There are several possible minor variations on this.

18 Apr 2010, 12:31 AM
#10
khopek avatar

khopek

Totally Zenned

Join Date:
Aug 2006
Location:
portlandish, oregon
Posts:
795
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

Perfect, thanks for the quick response. I new the page would be product_info, but was not sure what the rest was. :D

16 Jun 2011, 4:29 PM
#11
larryweiss avatar

larryweiss

New Zenner

Join Date:
Feb 2009
Posts:
23
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

I want to show a particular sidebox on a single page only. The sidebox
was made using blanl_sidebox_mod and works fine

The one page that this sidebox should appear on is an ezpage.

My problem is that to edit the code in that expage, Call it (page_x) I would have to go into the database. Is that true, Is there another approach.

I wish the ezpages would have their body with id="name if this page", for each ezpage. Then I could just {display:none} or{display:block} the (#body of this page) (.content of this sidenbox container).

Is there a good way to handle this situation?

Thanks in advance

17 Jun 2011, 6:06 AM
#12
gjh42 avatar

gjh42

Black Belt

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

Re: Show/Hide INformation Sidebox based on page

to edit the code in that expage, Call it (page_x) I would have to go into the database. Is that true, Is there another approach.There is nothing to edit in the db for the ez-page relative to sideboxes.

You would edit the sidebox module file for whatever sidebox it is. It should have something like

$show_whatever_sidebox = true;

if ($show_whatever_sidebox) {

//the module code

}
```Add after the $show_whatever_sidebox = true; statement```php
if (!($current_page_base == 'page' and $_GET['id'] == '4')) { //replace 4 with your ez-page id
  $show_whatever_sidebox = false;
}
17 Jun 2011, 3:21 PM
#13
larryweiss avatar

larryweiss

New Zenner

Join Date:
Feb 2009
Posts:
23
Plugin Contributions:
0

Re: Show/Hide INformation Sidebox based on page

Thanks so much gjh42 for the reply.

It was just that easy.

So let me add a few search words for anyone else with this requirement.

The fix works with ezpages and with listing pages.

Though I had asked about showing a particular, unique, specific sidebox to appear / show on one particular, unique, specific ezpage, it seems to work for any page with an id. (which I guess is any page except the home page.

I wound up needing it on a listing page, and it worked GREAT.

Thanks again.