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)
-   -   How to detect "Home" page in template files? (https://forum.x-cart.com/showthread.php?t=9171)

moza 08-31-2004 06:03 AM

How to detect "Home" page in template files?
 
Hi,

What is the easiest way to detect the "home" page inside the template files?

I know that there is a variable called $main, but I think there is not any value like "home" for this variable, and also there is another one, $location, but I don't know what exactly is the value for home page.

I want to change the layout based on the page structure, I think the layout must be related to the page structure, so I changed the table base layout and used, DIV tags to define different sections and in this case it is very easy to filter the sections, or even columns, based on page structure, so I need to know exactly every possibility for different structures, I found some of them under customer/home_main.tpl, but I am not sure about any other possibility, how can I know how many different structure do we have.

Thanks for any help.

I am working on 4.0.3

groovico 08-31-2004 07:05 AM

If $main = "" then your on home :)

eg in smarty

{if $main eq ""}
Your on home page
{/if}

moza 08-31-2004 03:36 PM

Quote:

Originally Posted by groovico
If $main = "" then your on home :)

{/if}


This doesn't work, the reason is, when we are in home page the value of $main is "catalog" not "", but this value is not unique for home page this is the same for product pages may be because they are using "home.php".

When we going to cart.php, the $main value changes to "cart", so the value of $main is related to the .php page, so the question is how to know we are in home page, is there any other variable that I can check it, I tried "$location" but, it doesn't say anything in the home page. Is there any way to check the categories? because in the home page there is not any category selected, so I think we can check if the $main value was "catalog" and the category value was "" so we are in home page. Is it correct? How to check the category?

Thanks,

moza 08-31-2004 04:15 PM

I checked the following code and it is working:

{if $cat eq "0"}

As far as I know it works fine, I don't know is there any variable that we can check?

Thanks

moza 08-31-2004 05:24 PM

this one is work as well:

$main eq "catalog" and $current_category.category eq ""

TelaFirma 09-01-2004 08:03 AM

Quote:

Originally Posted by moza
this one is work as well:

$main eq "catalog" and $current_category.category eq ""


That is the exact way that it is done in /customer/home_maim.tpl to display the welcome template.

Code:

{if $main eq "catalog" and $current_category.category eq ""}
....
{/if}



All times are GMT -8. The time now is 06:36 PM.

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