Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / override tpl_categories.php on main_page only

override tpl_categories.php on main_page only

Locked

Views: 1,929

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
27 Sep 2008, 10:54 PM
#1
k4satin avatar

k4satin

New Zenner

Join Date:
Mar 2006
Location:
Sacramento, CA
Posts:
93
Plugin Contributions:
0

override tpl_categories.php on main_page only

Is there a way to do this? I've seen lots of information about enabling or disabling the whole column, but I just want to change the categories layout on the home page. Even if I created a new sidebox, I don't see a way to enable different sideboxes within the column on specific pages...

28 Sep 2008, 3:13 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: override tpl_categories.php on main_page only

And what difference are you seeking?

28 Sep 2008, 5:02 AM
#3
k4satin avatar

k4satin

New Zenner

Join Date:
Mar 2006
Location:
Sacramento, CA
Posts:
93
Plugin Contributions:
0

Re: override tpl_categories.php on main_page only

I've already completely customized this file. In retrospect I probably should have used a new sidebox instead since I'm not using any of the original functionality. You can see what's there in the left column of https://www.thesatinbutton.com.

On the home page, since I added all the categories back in the center column (I just did that manually), I want to put paragraphs instead of bullets under each category heading on the left. The links will be embedded in the paragraphs, but with a little more text. The categories listed on the left are the ones I've chosen to focus on for seo & I'm creating content-rich silo pages that each will link to. (as with Baby Bunch & Mark Roberts links so far)

I was going to leave the left column how it is now on all pages except the home page (or I could possibly revert it back to a true category listing with all the subs... - open for opinions on what's better taking into consideration both seo & conversions... that's another discussion, though).

28 Sep 2008, 1:48 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: override tpl_categories.php on main_page only

You can look at the comments in the file /common/tpl_main_page.php and create one for your home page according to the conventions listed

30 Sep 2008, 3:24 AM
#5
k4satin avatar

k4satin

New Zenner

Join Date:
Mar 2006
Location:
Sacramento, CA
Posts:
93
Plugin Contributions:
0

Re: override tpl_categories.php on main_page only

Thanks for your reply. I already tried this, but maybe I'm not doing it right. When I put a new file named tpl_categories.php here:

includes/templates/my_template/index/tpl_categories.php

..the changes carried over to all pages, not just the home page. When I placed it here:

includes/templates/my_template/main_page/tpl_categories.php

..nothing happened.

Where should I put this file to make it only override on my home page?

30 Sep 2008, 6:47 AM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: override tpl_categories.php on main_page only

I suggested that you create a custom common/tpl_main_page.php file for your home page & not a tpl_categories.php

30 Sep 2008, 8:15 AM
#7
k4satin avatar

k4satin

New Zenner

Join Date:
Mar 2006
Location:
Sacramento, CA
Posts:
93
Plugin Contributions:
0

Re: override tpl_categories.php on main_page only

kobra:

I suggested that you create a custom common/tpl_main_page.php file for your home page & not a tpl_categories.php

OK, so let's see if I've got this right. I'm going to take a tpl_main_page.php and basically replace this:

<?php require(DIR_WS_MODULES . zen_get_module_directory('column_left.php')); ?>

with my own content.

Now, to make these changes show only on the home page, I've tried putting this file under a folder called index, but the changes carry over to all other pages I haven't done additional overrides for. I've tried putting it in a folder called main_page, and nothing happens. Do I need to only use one copy of tpl_main_page and place an if statement like this:

if ($current_page_base == 'index' and $cPath == ''){
$content .= 'my content here?';
}

I'm trying this, but I don't seem to be getting the syntax quite right.

30 Sep 2008, 8:21 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: override tpl_categories.php on main_page only

I wouldn't worry about changing tpl_main_page.php for handling the sidebox.

Instead, in your /includes/templates/YOUR_TEMPLATE/sideboxes/tpl_categories.php file, add some logic to conditionally display your paragraphs instead of the usual bulletted category details.

if ($this_is_home_page == true) {
   build your home-page content here
} else {
   put the regular sidebox content here
}
6 Oct 2008, 8:37 AM
#9
k4satin avatar

k4satin

New Zenner

Join Date:
Mar 2006
Location:
Sacramento, CA
Posts:
93
Plugin Contributions:
0

Re: override tpl_categories.php on main_page only

Thanks for all the advice. I think I've decided not to change it after all, but it's good to know. I think I'm going to take those links in the middle out of list form and make them smaller closer to the bottom. When I'd originally taken them out of my left column, my hits went way down, so I put them back on the page, but the two lists didn't look good next to each other.