Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Customising the main page template

Customising the main page template

Views: 1,031

Results 1 to 9 of 9
14 May 2013, 6:51 PM
#1
boydbreen avatar

boydbreen

New Zenner

Join Date:
Oct 2012
Posts:
48
Plugin Contributions:
0

Customising the main page template

Hi Everyone

I am trying to make the following changes and need some help.

I have a left box a centre box and right hand side box
What I would like to do is turn the right hand side box off on certain pages

I can see that this is ossible in the main page template so how do I create a page specific main ppage template
I have had a look in the file and it does say that I can copy it call it by the page name and edit a specific page but I dont seem to be doing something corretcly can anyone point me in the right direction

regards

14 May 2013, 8:35 PM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Customising the main page template

The simplest way to do this (especially if you have more than one page where you want the right sidebar off) is to use the commented code near the top of tpl_main_page.php: ```php
// the following IF statement can be duplicated/modified as needed to set additional flags
if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
$flag_disable_right = true;
}

14 May 2013, 8:38 PM
#3
gjh42 avatar

gjh42

Black Belt

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

Re: Customising the main page template

"Current_page_base" is what you see in the address bar after main_page=.

14 May 2013, 10:36 PM
#4
boydbreen avatar

boydbreen

New Zenner

Join Date:
Oct 2012
Posts:
48
Plugin Contributions:
0

Re: Customising the main page template

gjh42:

"Current_page_base" is what you see in the address bar after main_page=.

Thanks for your help so far I have located the file and managed to change the privacy age easy enough however I am running the ultimate seo URL add on and It seems no matter how I try I cant get pages effected by the mod to work.

the page I am trying to alter is

.avinstalls.co.uk/tv-installation-services-c-1_2.html

I have tried using this URL and what I presume would be the natural URL index&cPath=1_2

I have also tried cPath=1_2

starting to hurt my head now lol

14 May 2013, 10:47 PM
#5
gjh42 avatar

gjh42

Black Belt

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

Re: Customising the main page template

index&cPath=1_2 is not a page base, it is a complete category path. Since it is an "index" page, you need to use that in the test. However, "index" includes the homepage, category listings and product listings, so for this you would need to use one of the other commented tests in tpl_main_page.php. Don't change the one that is working for your privacy page, but uncomment and tweak this one: ```php

  • // example to not display right column on main page when Always Show Categories is OFF<br />
  • <br />
  • if ($current_page_base == 'index' and $cPath == '') {<br />
  • $flag_disable_right = true;<br />
  • }<br />
    Copy the code to lower in the file (say just above the if(in_array... test) and edit like this:php
    if ($current_page_base == 'index' and $cPath == '1_2') {
    $flag_disable_right = true;
    }
14 May 2013, 10:59 PM
#6
boydbreen avatar

boydbreen

New Zenner

Join Date:
Oct 2012
Posts:
48
Plugin Contributions:
0

Re: Customising the main page template

To Man / or Lady

Thanks so much I seem to have that upp and running now much appreciated.
I am trying to reorganise the category listing pages I need to add content but am finding if you start a category of with 500 words before you get to the next to the next ppage options you are well below the fold.
I am considering moving the product listings or list sub categories above the category description so in the fold there is a clear route to the next page and below that all the written content to assist in rankings.

By the way I love zencart I knew nothing about all this jazz a year ago and now I am customising and adding new stiff all the time its a fantastic piece of kit :)

14 May 2013, 11:07 PM
#7
gjh42 avatar

gjh42

Black Belt

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

Re: Customising the main page template

You will need to edit /includes/templates/your_template/templates/tpl_index_categories.php (copy it from /template_default/).
Move this part ```php

<?php // categories_description if ($current_categories_description != '') { ?> <div id="categoryDescription" class="catDescContent"><?php echo $current_categories_description; ?></div> <?php } // categories_description ?> ``` to immediately below```php <!-- EOF: Display grid of available sub-categories --> ``` There could be other locations to move it to, depending on your exact layout desires.
14 May 2013, 11:36 PM
#8
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Customising the main page template

BoydBreen:

To Man / or Lady
Glenn is a guy..

14 May 2013, 11:51 PM
#9
boydbreen avatar

boydbreen

New Zenner

Join Date:
Oct 2012
Posts:
48
Plugin Contributions:
0

Re: Customising the main page template

Thanks Glenn for all you help :)