Zen Cart Logo
Forums / General Questions / Display individual sidebox on only one Ez Page

Display individual sidebox on only one Ez Page

Views: 1,170

Results 1 to 11 of 11
26 Mar 2012, 7:36 PM
#1
creamcrackers avatar

creamcrackers

Zen Follower

Join Date:
May 2009
Posts:
228
Plugin Contributions:
1

Display individual sidebox on only one Ez Page

Hi

Following the instructions here https://www.zen-cart.com/tutorials/index.php?article=249

if (!isset($ezpage_id) || !in_array($ezpage_id,explode(",",'2,5'))) {

This condition means that the template to display the sidebox will be called whenever the page is not an EZ-Page or, if it is an EZ-Page, it does not have ID 2 or 5

What i want is a condition that will display the sidebox only when it is an EZ page and only when that EZ page ID is X

I hope someone can help!

Ive also seen this

https://www.zen-cart.com/tutorials/index.php?article=270

if ($this_is_home_page) { ......

Could i change that to .,. if this is ez page id X then.......

How can i do this?

Thanks you

26 Mar 2012, 8:58 PM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Display individual sidebox on only one Ez Page

if (isset($ezpage_id) and $ezpage_id == '3') {
26 Mar 2012, 11:17 PM
#3
creamcrackers avatar

creamcrackers

Zen Follower

Join Date:
May 2009
Posts:
228
Plugin Contributions:
1

Re: Display individual sidebox on only one Ez Page

thanks for that

26 Mar 2012, 11:19 PM
#4
creamcrackers avatar

creamcrackers

Zen Follower

Join Date:
May 2009
Posts:
228
Plugin Contributions:
1

Re: Display individual sidebox on only one Ez Page

<?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_bangkok = true; if ($show_blank_sidebox_bangkok == true) { if (isset($ezpage_id) and $ezpage_id == '1') { require($template->get_template_dir('tpl_blank_sidebox_bangkok.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox_bangkok.php'); $title = BOX_HEADING_BLANK_SIDEBOX_BANGKOK; $title_link = false; require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); } ?>

breaks my site :(

26 Mar 2012, 11:47 PM
#5
gjh42 avatar

gjh42

Black Belt

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

Re: Display individual sidebox on only one Ez Page

// test if box should display
$show_blank_sidebox_bangkok = false;
if (isset($ezpage_id) and $ezpage_id == '1') { 
  $show_blank_sidebox_bangkok = true;
}

if ($show_blank_sidebox_bangkok == true) {
  require($template->get_template_dir('tpl_blank_sidebox_bangkok.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox_bangkok.php');
26 Mar 2012, 11:52 PM
#6
creamcrackers avatar

creamcrackers

Zen Follower

Join Date:
May 2009
Posts:
228
Plugin Contributions:
1

Re: Display individual sidebox on only one Ez Page

ah ha - do appologise i missed a curly bracket at the end works now thank so much

26 Mar 2012, 11:54 PM
#7
creamcrackers avatar

creamcrackers

Zen Follower

Join Date:
May 2009
Posts:
228
Plugin Contributions:
1

Re: Display individual sidebox on only one Ez Page

i did this.. works

<?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_bangkok = true; if ($show_blank_sidebox_bangkok == true) { if (isset($ezpage_id) and $ezpage_id == '1') { require($template->get_template_dir('tpl_blank_sidebox_bangkok.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox_bangkok.php'); $title = BOX_HEADING_BLANK_SIDEBOX_BANGKOK; $title_link = false; require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); } } ?>
27 Mar 2012, 2:12 AM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Display individual sidebox on only one Ez Page

Yes, that will work, though it ignores the purpose of the $show_whatever flag.

29 Mar 2012, 3:56 AM
#9
warroyo90 avatar

warroyo90

New Zenner

Join Date:
Jan 2012
Posts:
59
Plugin Contributions:
0

Re: Display individual sidebox on only one Ez Page

How would this work with an overridden sidebox that does not contain the specified code:

 require($template->get_template_dir('tpl_order_history.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_order_history.php');
    $title =  BOX_HEADING_CUSTOMER_ORDERS;
    $title_link = false;
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);

thanks!

29 Mar 2012, 4:01 AM
#10
warroyo90 avatar

warroyo90

New Zenner

Join Date:
Jan 2012
Posts:
59
Plugin Contributions:
0

Re: Display individual sidebox on only one Ez Page

here is my code :

<?php
// -----------------------------------
// MY CUSTOM SIDE PANEL ITEM
// -----------------------------------

  // test if box should be displayed
 
  $show_categories = true;

  if ($show_categories  == true) {

some html code;

}
?>
29 Mar 2012, 3:06 PM
#11
gjh42 avatar

gjh42

Black Belt

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

Re: Display individual sidebox on only one Ez Page

Exactly the same as in post 5 (adjusted for variable names etc.)
Your HTML takes the place of the require() statement.