Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Making home.php only control home page not catergories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-01-2006, 06:49 PM
 
robf robf is offline
 

Advanced Member
  
Join Date: May 2006
Posts: 61
 

Default Making home.php only control home page not catergories

Hi All, I'm trying to get a certain look with xcart and slowly getting there. I wanted my product.tpl page to load outside the normal template and take up the whole screen, as in lose the left column, I managed to do that.

Now I want my home page to have a left and right column, right side for news, but the rest of the site I want it to have 1 column and drop the right column. I'm able to do that for the most part however all the categories point to the home.php file. So when I make the changes my home page has both columns, I can go anywhere else and I only have the left column, just as I want, however when I click a category and see the list of products or sub categories I also get the right column, thats because all the links point to the home.php file.

Is there any way to have the category links called from a different file other than home.php? I don't understand why they both share the same file. If these weren't linked together it would be no problem having a different template for all the pages.

I created a new .php file and located it in the same place as the home.php, then I went through a ton of other files that I thought held the links for the categories and changed all references from home.php to the new .php file. The new .php file pointed to the home.tpl so I get the 1 column template. But every change I made, which was a lot, seemed to make no difference. The category links are always pointing to home.php

I think if I can find out where to change the actual link for the categories I might be able to do it. Would anybody have any ideas?

Thanks
Rob
__________________
x-cart 4.1.6
PHP 4.4.2
MySQL server 4.0.26-log
MySQL client 5.0.20
Operation system FreeBSD
Perl 5.008008
Reply With Quote
  #2  
Old 08-01-2006, 08:14 PM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default

I think you are working too hard. Instead of changing code all over the place, try this approach. In home.tpl add this before the third column HTML:
Code:
{if $main eq "catalog" and $current_category.category eq ""}
Then after the last line of the third column HTML in home.tpl add:
Code:
{/if}
Thats it. No php changes required, no chasing down links all over the place.

BTW, please add your version into your signature. Sometimes answers are very version dependent. My answer applies to versons 4.0.14 and 4.0.18 for sure and probably 4.1.x versions and earlier 4.0.x versions.
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote
  #3  
Old 08-01-2006, 11:37 PM
 
robf robf is offline
 

Advanced Member
  
Join Date: May 2006
Posts: 61
 

Default

ah, you're amazing! Seems so hard yet so simple.

I use 4.1.2 and its in my signature, your were probably looking in the topic review window, it doesn't show there.

Thanks so much!
__________________
x-cart 4.1.6
PHP 4.4.2
MySQL server 4.0.26-log
MySQL client 5.0.20
Operation system FreeBSD
Perl 5.008008
Reply With Quote
  #4  
Old 08-02-2006, 07:18 AM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default

Quote:
Originally Posted by robf
I use 4.1.2 and its in my signature, your were probably looking in the topic review window, it doesn't show there.

Sorry, yes you are right. Glad I could help.
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote
  #5  
Old 08-03-2006, 08:24 AM
 
ecommerce ecommerce is offline
 

eXpert
  
Join Date: Jul 2006
Posts: 267
 

Default

Quote:
Originally Posted by geckoday
I think you are working too hard. Instead of changing code all over the place, try this approach. In home.tpl add this before the third column HTML:
Code:
{if $main eq "catalog" and $current_category.category eq ""}
Then after the last line of the third column HTML in home.tpl add:
Code:
{/if}

Geckotoday, can u please explain what this does in plain newbie terms?
__________________
X-Cart 4.0.18 DBest
Reply With Quote
  #6  
Old 08-03-2006, 10:02 AM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default

Quote:
Originally Posted by ecommerce
Quote:
Originally Posted by geckoday
I think you are working too hard. Instead of changing code all over the place, try this approach. In home.tpl add this before the third column HTML:
Code:
{if $main eq "catalog" and $current_category.category eq ""}
Then after the last line of the third column HTML in home.tpl add:
Code:
{/if}

Geckotoday, can u please explain what this does in plain newbie terms?
home.tpl is used to display a whole bunch of different site pages - the home page, category pages, help pages, etc. The php code that uses home.tpl assigns a value to variable $main to tell the template what should be displayed. If it is to display a category $main is set to "catalog" and $current_category.category is set to the category name. If the home page is to be displayed $main is set to "catalog" and $current_category.category is set to an empty string.

The smarty {if ...} {/if} defines a block of html and smarty code that should only be included if the condition in the {if ...} is true.

So putting the third column inside the {if ...} and {/if} means it will only be displayed if the condition inside the if is true. In this case if $main is set to "catalog" and $current_category is an empty string - the condition for displaying the home page.

So the third column will only be displayed on the home page.

Which come to think of it isn't exactly what was being asked for. To remove the third column from only the category pages it really should be this:

Add this before the third column HTML:
Code:
{if $main eq "catalog" and $current_category.category ne ""} {else}
Then after the last line of the third column HTML in home.tpl add:
Code:
{/if}


So do you know what $main is set to for what page? Take a look at home_main.tpl.
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote
  #7  
Old 08-03-2006, 06:34 PM
 
ecommerce ecommerce is offline
 

eXpert
  
Join Date: Jul 2006
Posts: 267
 

Default

good explanation!

I guess thats how mosaic template works.

on the home page, it doesnt show the third column.
__________________
X-Cart 4.0.18 DBest
Reply With Quote
  #8  
Old 08-03-2006, 08:52 PM
 
jdedba jdedba is offline
 

Advanced Member
  
Join Date: Dec 2004
Posts: 96
 

Default

Quote:
Originally Posted by geckoday
I think you are working too hard. Instead of changing code all over the place, try this approach. In home.tpl add this before the third column HTML:
Code:
{if $main eq "catalog" and $current_category.category eq ""}
Then after the last line of the third column HTML in home.tpl add:
Code:
{/if}
Thats it. No php changes required, no chasing down links all over the place.

BTW, please add your version into your signature. Sometimes answers are very version dependent. My answer applies to versons 4.0.14 and 4.0.18 for sure and probably 4.1.x versions and earlier 4.0.x versions.

What do you mean "third column HTML in home.tpl "?
Does it mean after
Code:
?

Thanks a lot.
__________________
version 4.1.1
Reply With Quote
  #9  
Old 08-03-2006, 09:35 PM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default

Quote:
Originally Posted by jdedba
What do you mean "third column HTML in home.tpl "?
Does it mean after
Code:
?

Thanks a lot.
Not right after that, after the </td> two lines after that. The closing </if> goes right above:
Code:
<TD width="6"></TD>
a few lines up from the end of the file.
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:00 AM.

   

 
X-Cart forums © 2001-2020