Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Need both side columns on home page only

Need both side columns on home page only

Views: 749

Results 1 to 5 of 5
24 Mar 2012, 2:27 PM
#1
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Need both side columns on home page only

Hi,

Lots of people want to turn side columns off on the home page. On a site I'm working on I need them both on there. The left side column is on throughout the site, but the client wants the right side column visible only on the home page.

In admin/Configuration/Layout Settings I can turn on the right side column for the whole site, of course. But there seems to be no settings that affect just the home page. So first question, has anyone written a mod which gives those added settings?

If no mod exists, how can I approach this? Maybe I can turn on the global setting for the right side column, and then create an override of the tpl_main_page.php file in which I turn off the right sideboxes (and the entire right side column?). But where should that override file go to avoid affecting the home page? Or is it another file that needs to be overridden? Maybe I can override the admin setting when it's off, so that the override is just for the home page and turns it on there?

As you can see, I need a little guidance.

Thanks,

Rob

ZC v1.3.9h

24 Mar 2012, 5:38 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

Re: Need both side columns on home page only

This just requires a small change to /includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php close to the top you'll see the comment in the code fragment below to know where to place it:

// the following IF statement can be duplicated/modified as needed to set additional flags
  if (!$this_is_home_page) {
    $flag_disable_left = true;
    $flag_disable_right = true;
  }
24 Mar 2012, 7:55 PM
#3
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Need both side columns on home page only

Um, would that disable both side columns on the Home page? Or is that code a double negative? :blink:

I'm trying to show both side columns on the Home page while leaving only the left column everywhere else.

Rob

24 Mar 2012, 8:12 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

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

Re: Need both side columns on home page only

Hi Rob

The ! before $this_is_home_page

says: If this is NOT the home page, then disable both left and right columns.

I would therefore say that the following would give you your desired effect

// the following IF statement can be duplicated/modified as needed to set additional flags
  if (!$this_is_home_page) {
    $flag_disable_right = true;
  }
24 Mar 2012, 8:21 PM
#5
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Need both side columns on home page only

schoolboy:

Hi Rob

The ! before $this_is_home_page

says: If this is NOT the home page, then disable both left and right columns.

I would therefore say that the following would give you your desired effect

// the following IF statement can be duplicated/modified as needed to set additional flags
if (!$this_is_home_page) {
$flag_disable_right = true;
}

Ah! It's the little things. :lamo:

So I take it that I turn on the right column in admin, then use this bit of code in my override of tpl_main_page.php. I'll try that right now. ... ... ...

Bingo!

Thanks

Rob