Forums / General Questions / Specific sideboxe to show on specific page only

Specific sideboxe to show on specific page only

Views: 2,121

Results 1 to 19 of 19
12 Jul 2012, 7:30 AM
#1
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Specific sideboxe to show on specific page only

Hey everyone,

https://www.royal-fleur.com

I would to have a specific sideboxe appear on one specific page only.

I would like to have blank_sideboxe to appear only on www.royal-fleur/forist-sa-rafael-ca page only.

I look thru the forum and tried a few things but no luck. All i Found mostly was for ez page...

I tried the following code in modules/sideboxe/blank_sideboxe.php:

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

if (in_array($_GET['main_page'], array(FILENAME_SAN_RAFAEL))) {
$show_blank_sidebox = true
} else
$show_blank_sidebox = false

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);
}
?>

but it make the whole website disappear when i turn the sideboxe on. Only the header shows up

Please help me with this as I am a newbie when it comes to php programming

Thank you in advance

12 Jul 2012, 6:27 PM
#3
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

stevesh:

The basic principle is here - you'll have to adjust the code to reflect the page where you want to have the box display:

http://www.zen-cart.com/content.php?251-i-want-to-display-some-of-my-sideboxes-on-my-front-page-only-and-suppress-them-from-all-other-pages

I read this tutorial but I am confused. This is for the home page

In my case, I want the sideboxe to show only on one page which is not the main page or an ez page

How do I modify this statement:

if ($this_is_home_page) {
$show_featured = true;
} else {
$show_featured = false;
}

so my sideboboxe shows up on the following page: https://www.royal-fleur.com/florist-san-rafael-ca only

The file name for this page is SAN_RAFAEL

Any help is more than welcome

Thank you

12 Jul 2012, 7:41 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

CSS may be easier...

If you want the sidebox to be hidden on ALL pages EXCEPT one specific page, then you create a declaration in the main stylesheet that says:

#mySidebox {display:none;}

Then you create a PAGE-SPECIFIC stylesheet (for whatever page you want that sidebox on) and change the declaration to:

#mySidebox {display:block;}

Look at the stylesheet README file in the main CSS folder (probably classic/css) for instructions on creating page-specific stylesheets.

SEE IT IN ACTION (sort of)...

GRAPHIC SIDEBOX is ON

GRAPHIC SIDEBOX is OFF

20 years a Zencart User

12 Jul 2012, 7:43 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

One problem may be that you have some stupid URL re-writer in place...

What is your objective for using a URL re-writer... they make life more challenging than it needs to be...

20 years a Zencart User

13 Jul 2012, 2:19 AM
#6
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

schoolboy:

CSS may be easier...

If you want the sidebox to be hidden on ALL pages EXCEPT one specific page, then you create a declaration in the main stylesheet that says:

#mySidebox {display:none;}

Then you create a PAGE-SPECIFIC stylesheet (for whatever page you want that sidebox on) and change the declaration to:

#mySidebox {display:block;}

Look at the stylesheet README file in the main CSS folder (probably classic/css) for instructions on creating page-specific stylesheets.

SEE IT IN ACTION (sort of)...

GRAPHIC SIDEBOX is ON

GRAPHIC SIDEBOX is OFF

I dont think CSS would work in my case. I planning on adding 5 specific sideboxe to 5 unique page so it would prob increase page load time.

13 Jul 2012, 2:37 AM
#7
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

schoolboy:

One problem may be that you have some stupid URL re-writer in place...

What is your objective for using a URL re-writer... they make life more challenging than it needs to be...

Even if I turn off the url rewriter, it does not work.

The correct page would be http://www.royal-fleur.com/index.php?main_page=san_rafael

How do i modify the code for it?

I don t want to use css because i would be adding too many specific page sideboxe and it will increase my main page load time which already slow from my swf soon to be jsquery.

Thank for your help with this

13 Jul 2012, 8:39 AM
#8
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

nicksab:

so it would prob increase page load time.

The additional CSS is a single declaration... Maybe increases page load time by seven-trillionths of a second...

20 years a Zencart User

15 Jul 2012, 6:26 AM
#9
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

schoolboy:

The additional CSS is a single declaration... Maybe increases page load time by seven-trillionths of a second...

I created a page specific stylesheet called san_rafael.css with the folowing inside of it:

/**

  • Main CSS Stylesheet
  • @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: san_rafael.css 5952 2007-03-03 06:18:46Z drbyte $
    */

#blanksidebox {display:block;}

Then I added #blanksidebox {display:none;} to stylesheet.css

When I go to the main page, the sidebox is not showing but it is not showing on the other page either

I must be missing something or did something wrong.

Could you please help me?

Thank you

15 Jul 2012, 7:13 AM
#10
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

I've done a lot of sidebox 'placement' on a website - maybe I can be of some use.

While I haven't needed to have a sidebox on one page only I have had a sidebox appear on all pages except one, so the code should be able to be switched.

Is your page a 'define page'? i.e. is there a folder for it in /includes/modules/pages ? if so what is its name?

Simon

15 Jul 2012, 8:37 AM
#11
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

I still maintain the URL rewriter is an issue here... but even so, that's your choice:

Look here: http://www.zen-cart.com/showthread.php?44364

20 years a Zencart User

15 Jul 2012, 6:49 PM
#12
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

schoolboy:

I still maintain the URL rewriter is an issue here... but even so, that's your choice:

Look here: http://www.zen-cart.com/showthread.php?44364

I tried it with the rewritter off so the actual page id shows up but I have the same problem with the sideboxe

Hidden everywhere even with the page specific .css

15 Jul 2012, 6:51 PM
#13
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

simon1066:

I've done a lot of sidebox 'placement' on a website - maybe I can be of some use.

While I haven't needed to have a sidebox on one page only I have had a sidebox appear on all pages except one, so the code should be able to be switched.

Is your page a 'define page'? i.e. is there a folder for it in /includes/modules/pages ? if so what is its name?

Yes the page was created on the about_us page mod so it is a define page. there is a folder for it in .../includes/modules/pages.

The name of the folder is san_rafael and the folder contains the header.php file for this specific page.

Thank you for your help on this issue

16 Jul 2012, 6:43 AM
#14
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

nicksab:

Yes the page was created on the about_us page mod so it is a define page. there is a folder for it in .../includes/modules/pages.

The name of the folder is san_rafael and the folder contains the header.php file for this specific page.

Thank you for your help on this issue

The code I use if I want to have blank_sidebox NOT appear on san_rafael page is:

if (in_array($current_page_base,explode(",",'san_rafael')) ) {
$$show_static_blank_sidebox = false;
} else {
$show_static_blank_sidebox = true;
}

So I think that to have this sidebox ONLY appear on san_rafael page I would replace your code in modules/sideboxes/blank_sidebox.php:

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

if (in_array($_GET['main_page'], array(FILENAME_SAN_RAFAEL))) {
$show_blank_sidebox = true
} else
$show_blank_sidebox = false

with:

// test if box should display

if (in_array($current_page_base,explode(",",'san_rafael')) ) {
$$show_static_blank_sidebox = true;
} else {
$show_static_blank_sidebox = false;
}

It shouldn't matter that the url for san_rafael has been rewritten, I use rewrites (CEON mapping) and don't seem to have an issue.

As I type I notice that your code seems to be missing some brackets:

if (in_array($_GET['main_page'], array(FILENAME_SAN_RAFAEL))) {
$show_blank_sidebox = true
} else {
$show_blank_sidebox = false
}

Perhaps that was the problem?

Hope it works.

Simon

17 Jul 2012, 2:28 AM
#15
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

simon1066:

The code I use if I want to have blank_sidebox NOT appear on san_rafael page is:

if (in_array($current_page_base,explode(",",'san_rafael')) ) {
$$show_static_blank_sidebox = false;
} else {
$show_static_blank_sidebox = true;
}

So I think that to have this sidebox ONLY appear on san_rafael page I would replace your code in modules/sideboxes/blank_sidebox.php:

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

if (in_array($_GET['main_page'], array(FILENAME_SAN_RAFAEL))) {
$show_blank_sidebox = true
} else
$show_blank_sidebox = false

with:

// test if box should display

if (in_array($current_page_base,explode(",",'san_rafael')) ) {
$$show_static_blank_sidebox = true;
} else {
$show_static_blank_sidebox = false;
}

It shouldn't matter that the url for san_rafael has been rewritten, I use rewrites (CEON mapping) and don't seem to have an issue.

As I type I notice that your code seems to be missing some brackets:

if (in_array($_GET['main_page'], array(FILENAME_SAN_RAFAEL))) {
$show_blank_sidebox = true
} else {
$show_blank_sidebox = false
}

Perhaps that was the problem?

Hope it works.

Thank you for helping me with this.

I tried your code but it does not work.

If i use

if (in_array($current_page_base,explode(",",'san_rafael')) ) {
$$show_static_blank_sidebox = true;
} else {
$show_static_blank_sidebox = false;
}

The blank_sideboxes does not show anywhere.

And if i try:

if (in_array($current_page_base,explode(",",'san_rafael')) ) {
$$show_static_blank_sidebox = false;
} else {
$show_static_blank_sidebox = true;
}

The blank_sidebox shows everywhere.

I put these code in /includes/modules/sideboxes/smooth_green/blank_sidebox.php

Any ideas what could be the problem?

Thank you

17 Jul 2012, 5:30 AM
#16
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

If I use this code

if (in_array($current_page_base,explode(",",'san_rafael')) ){
$$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);
}
?>

The sideboxe shows everywhere except on san_rafael.

If I change the code to

if (in_array($current_page_base,explode(",",'san_rafael')) ){
$$show_blank_sidebox = true;
} else {
$show_blank_sidebox = false;
}

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);
}
?>

It does not show anywhere.

What am I missing here??

17 Jul 2012, 5:57 AM
#17
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

Sorry, all out of ideas I'm afraid - as I say it works for me.

I'll have to refer you back to schoolboy's answers, and also to the link he provided to another thread - which is where I got my information from.

Simon

17 Jul 2012, 6:10 AM
#18
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

simon1066:

Sorry, all out of ideas I'm afraid - as I say it works for me.

I'll have to refer you back to schoolboy's answers, and also to the link he provided to another thread - which is where I got my information from.

I finally got it to work by using this:

if ($current_page_base == 'san_rafael') {
$show_blank_sidebox = true;
} else {
$show_blank_sidebox = false;
}

Thank you for helping and pointing me in the right direction :smile:

17 Jul 2012, 6:22 AM
#19
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Specific sideboxe to show on specific page only

Excellent, well done.

Simon