X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Making home.php only control home page not catergories (https://forum.x-cart.com/showthread.php?t=23760)

robf 08-01-2006 06:49 PM

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

geckoday 08-01-2006 08:14 PM

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.

robf 08-01-2006 11:37 PM

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! :D

geckoday 08-02-2006 07:18 AM

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.

ecommerce 08-03-2006 08:24 AM

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?

geckoday 08-03-2006 10:02 AM

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.

ecommerce 08-03-2006 06:34 PM

good explanation!

I guess thats how mosaic template works.

on the home page, it doesnt show the third column.

jdedba 08-03-2006 08:52 PM

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.

geckoday 08-03-2006 09:35 PM

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.


All times are GMT -8. The time now is 06:01 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.