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

How to detect "Home" page in template files?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-31-2004, 06:03 AM
 
moza moza is offline
 

Member
  
Join Date: Apr 2003
Location: Australia
Posts: 22
 

Default 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
__________________
x-cart 3.5
Reply With Quote
  #2  
Old 08-31-2004, 07:05 AM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

If $main = "" then your on home

eg in smarty

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

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #3  
Old 08-31-2004, 03:36 PM
 
moza moza is offline
 

Member
  
Join Date: Apr 2003
Location: Australia
Posts: 22
 

Default

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,
__________________
x-cart 3.5
Reply With Quote
  #4  
Old 08-31-2004, 04:15 PM
 
moza moza is offline
 

Member
  
Join Date: Apr 2003
Location: Australia
Posts: 22
 

Default

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
__________________
x-cart 3.5
Reply With Quote
  #5  
Old 08-31-2004, 05:24 PM
 
moza moza is offline
 

Member
  
Join Date: Apr 2003
Location: Australia
Posts: 22
 

Default

this one is work as well:

$main eq "catalog" and $current_category.category eq ""
__________________
x-cart 3.5
Reply With Quote
  #6  
Old 09-01-2004, 08:03 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

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}
Reply With Quote

The following user thanks TelaFirma for this useful post:
Gibson1957 (10-21-2014)
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 11:32 AM.

   

 
X-Cart forums © 2001-2020