Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / home page only sidebox

home page only sidebox

Locked

Views: 5,573

Results 1 to 20 of 28
This thread is locked. New replies are disabled.
30 Aug 2006, 4:49 PM
#1
minnie_mouse avatar

minnie_mouse

Zen Follower

Join Date:
Jun 2005
Posts:
119
Plugin Contributions:
0

home page only sidebox

hi there, does anyone know if there are any examples of a sidebox that only shows up on the home page. i know how to build a new box... but i need to know how to write the IF statement to have it only show on the home page.

or if anyone knows how to write it that would be great.

thanks!
Minnie Mouse

30 Aug 2006, 5:11 PM
#3
minnie_mouse avatar

minnie_mouse

Zen Follower

Join Date:
Jun 2005
Posts:
119
Plugin Contributions:
0

Re: home page only sidebox

THANKS!
that was exactly what i needed. i did a search and couldnt find it.
MM

15 Feb 2009, 7:32 PM
#4
nightsdawn avatar

nightsdawn

New Zenner

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

Re: home page only sidebox

I am having the same problem and read the referring thread thoroughly. what I came up with was the following:

if ($_GET['main_page'] == 'index') {
$show_blank_sidebox = true;
} else {
$show_blank_sidebox = false;
}

Which works, however... I Only want this to show on the very very first page. As it stands now, if I click a product category the main page would then look like "index&cPath=2" so the box still shows.

Is there so code to add that makes the index "absolute" or is that even possible. And apologies in advance for replying to such an old post but I wasnt able to find anything else pertaining to this.

Thanks in advance!

15 Feb 2009, 8:21 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: home page only sidebox

Perhaps the variable:
$this_is_home_page

if ($this_is_home_page) {
// do something because I am
} else {
// do something else because I ain't
}

would be of help to you ... :smile:

16 Feb 2009, 12:23 AM
#6
nightsdawn avatar

nightsdawn

New Zenner

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

Re: home page only sidebox

Ajeh:

Perhaps the variable:
$this_is_home_page

Unfortunetely that didnt work at all. Im a php noob so I wasnt sure what you meant exactly but I tried the below iterations all of which completely disabled the sidebox.

if ($http://www.nativeamericancreations.com) {

if ($http://nativeamericancreations.com) {

if ($nativeamericancreations.com) {

if ($nativeamericancreations) {


  $show_blank_sidebox = true;
} else {
  $show_blank_sidebox = false;
}
16 Feb 2009, 12:25 AM
#7
ajeh avatar

ajeh

Oba-san

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

Re: home page only sidebox

I was being literal there is a variable literally called:
$this_is_home_page

When on the Home page the variable:
$this_is_home_page

will be true ...

When not on the Home page the variable:
$this_is_home_page

will be false ...

16 Feb 2009, 12:55 AM
#8
nightsdawn avatar

nightsdawn

New Zenner

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

Re: home page only sidebox

Lol I feel dumb now.... That worked perfectly!

http://nativeamericancreationsandmore.com/

Thank you so much! :clap:

16 Feb 2009, 3:55 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: home page only sidebox

Thanks for the update that this worked for you ... :smile:

28 Apr 2009, 11:18 PM
#10
krazey avatar

krazey

New Zenner

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

Re: home page only sidebox

I have a blank sidebox(twitter) and also want it to be only seen on the home page http://www.mydfashop.com/store
I have added $this_is_home_page to my blank_sidebox.php but it didn't work??? Do i need to remove or add anything else???
This is what i had

$this_is_home_page
   
  $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);
 }
?>
29 Apr 2009, 1:40 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: home page only sidebox

All you did is put the variable in your code, you need to actually use it ... :eek:

  if ($this_is_home_page == true) {
  // show it   
    $show_blank_sidebox = true;
  } else {
  // do not show it   
    $show_blank_sidebox = false;
  }  

  if ($show_blank_sidebox == true) {

See if this works better for you ... :smile:

30 Apr 2009, 1:38 AM
#12
krazey avatar

krazey

New Zenner

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

Re: home page only sidebox

Ok great, thanks alot, but im still getting it on each page. This is what i have:

// test if box should display
  if ($this_is_home_page == true) {
  // show it   
    $show_blank_sidebox = true;
  } else {
  // do not show it   
    $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);
 }
?>
30 Apr 2009, 5:18 AM
#13
ajeh avatar

ajeh

Oba-san

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

Re: home page only sidebox

In the Tools ... Developers Tool Kit ... in the bottom input box type in:
$show_blank_sidebox

Select the Catalog and click SEARCH ...

What files come up?

30 Apr 2009, 11:01 PM
#14
krazey avatar

krazey

New Zenner

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

Re: home page only sidebox

I did a search and the only file that shows up is
includes/modules/sideboxes/mydfa/blank_sidebox.php

/home/mydfas27/public_html/store/includes/modules/sideboxes/mydfa/blank_sidebox.php

Line #27 : $show_blank_sidebox = true; 

Line #29 : if ($show_blank_sidebox == true) { 

This is the correct file to put it in isn't it??? :unsure:

1 May 2009, 1:59 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: home page only sidebox

I have not been able to duplicate the problem ...

from what you have shown, the code appears correct ...

4 May 2009, 1:45 AM
#16
krazey avatar

krazey

New Zenner

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

Re: home page only sidebox

ok here is what i have in my blank_sidebox.php

<?php
//
// Blank Sidebox Mod
// includes/languages/english/extra_definitions/blank_sidebox.php
//
//  --------------------------------------------------
//  http://www.MommaMuse.com mod Zen-Cart - by Judi Cox                  
//  --------------------------------------------------
//  zen-cart Open Source E-commerce                                      
//  Copyright (c) 2003-2006 The zen-cart developers                           
//  http://www.zen-cart.com/index.php                                    
//  Portions Copyright (c) 2003 osCommerce                               
//  --------------------------------------------------
//  This source file is subject to version 2.0 of the GPL license,       
//  that is bundled with this package in the file LICENSE, and is        
//  available through the world-wide-web at the following url:           
//  http://www.zen-cart.com/license/2_0.txt.                             
//  If you did not receive a copy of the zen-cart license and are unable 
//  to obtain it through the world-wide-web, please send a note to       
//  [email protected] so we can mail you a copy immediately.
//  --------------------------------------------------
//
// $Id: blank_sidebox_defines.php,v 1.0 6/24/2006
// Original modification by Carter Harris [email protected] based on the tpl_featured.php file 
// Additionally modified by Judi Cox http://www.mommamuse.com

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

Is there anything in here that shouldn't be??? :cry:

4 May 2009, 2:18 PM
#17
ajeh avatar

ajeh

Oba-san

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

Re: home page only sidebox

You don't have any conditions to limit the code from displaying ... so it will show on all pages ...

This is the code that is missing to show it only on the home page and goes just above the IF statement:

// test if box should display
  if ($this_is_home_page == true) {
  // show it   
    $show_blank_sidebox = true;
  } else {
  // do not show it   
    $show_blank_sidebox = false;
  } 
5 May 2009, 12:35 AM
#18
krazey avatar

krazey

New Zenner

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

Re: home page only sidebox

Thank you so much!!! :clap:
That was what i was missing!!!

5 May 2009, 2:27 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: home page only sidebox

Glad that you got this working once you added the code ... thanks for the update ... :smile:

30 May 2009, 12:09 AM
#20
smoke133 avatar

smoke133

Zen Follower

Join Date:
Jul 2007
Location:
Roseville, Michigan
Posts:
188
Plugin Contributions:
0

Re: home page only sidebox

Would this work for the ezpage sidebox? If so, what would it look like?