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

help changing navigation tabs based on current page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-09-2004, 08:57 PM
 
zilker zilker is offline
 

Advanced Member
  
Join Date: Feb 2003
Posts: 89
 

Default help changing navigation tabs based on current page

Hello,

I need some help with my navigation tabs. They can be seen here:

http://toybuyandsell.com/store/customer/home.php

Basically, I want them to change based on what page the user is on. If they click the home page, the "home" tab will be selected. I was able to make this happen for the home, buy and help tabs by using the following if statements:

Code:
<table cellpadding=0 cellspacing=0 border=0> <tr valign="bottom"> <td>{if $main eq "catalog" and $current_category.category eq ""}[img]{$ImagesDir}/tab_home_.gif[/img]{else}[img]{$ImagesDir}/tab_home.gif[/img]{/if}</td> <td>{if $main eq "cart" or $main eq "wishlist" or $main eq "anonymous_checkout" or $main eq "checkout" or $main eq "product" or $main eq "giftcert" or $main eq "catalog"}[img]{$ImagesDir}/tab_buy_.gif[/img]{else}[img]{$ImagesDir}/tab_buy.gif[/img]{/if}</td> <td>[img]{$ImagesDir}/tab_sell.gif[/img]</td> <td>[img]{$ImagesDir}/tab_contact.gif[/img]</td> <td>{if $main eq "help"}[img]{$ImagesDir}/tab_help_.gif[/img]{else}[img]{$ImagesDir}/tab_help.gif[/img]{/if}</td> </tr> </table>

A simple if statement will provide the results of a "main" section but I haven't found out how to make it happen for a section under main. Example...contactus is under help. I've tried the following but it doesn't work:

Code:
{if $section eq "contactus"}[img]{$ImagesDir}/tab_contact_.gif[/img]{else}[img]{$ImagesDir}/tab_contact.gif[/img]{/if}

Can anyone help? I think it's just a smarty command that I don't know of.
__________________
~zilker

uummm...perhaps you should tell me again.

http://www.designertrends.com
Version 4.0.6
Unix
Reply With Quote
  #2  
Old 12-09-2004, 11:39 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

The section variable gets passed when the help.tpl is called through the common_templates.tpl so it won't be available globally. You can't then use it on your other templates.

You can try:

Code:
{$smarty.get.section}
Reply With Quote
  #3  
Old 12-10-2004, 10:23 AM
 
zilker zilker is offline
 

Advanced Member
  
Join Date: Feb 2003
Posts: 89
 

Default

Thanks for the reply. I took what you gave me and rearranged the if statements. Just incase anyone else wants to use this idea, here's the code.

Code:
<table cellpadding=0 cellspacing=0 border=0 align="right"> <tr valign="bottom"> <td> {if $main eq "catalog" and $location eq ""} [img]{$ImagesDir}/tab_home_.gif[/img] {else} <a href="home.php"> [img]{$ImagesDir}/tab_home.gif[/img]</a>{/if} </td> <td> {if $main eq "cart" or $main eq "wishlist" or $main eq "anonymous_checkout" or $main eq "checkout" or $main eq "product" or $main eq "giftcert"} [img]{$ImagesDir}/tab_buy_.gif[/img] {elseif $main eq "catalog" and $location ne ""} [img]{$ImagesDir}/tab_buy_.gif[/img] {elseif $smarty.get.section eq "buy"} [img]{$ImagesDir}/tab_buy_.gif[/img] {else} [img]{$ImagesDir}/tab_buy.gif[/img] {/if} </td> <td> {if $smarty.get.section eq "sell"}[img]{$ImagesDir}/tab_sell_.gif[/img] {else} <a href="help.php?section=contact_us"> [img]{$ImagesDir}/tab_contact.gif[/img]</a> {/if} </td> <td> {if $smarty.get.section eq "contact_us"} [img]{$ImagesDir}/tab_contact_.gif[/img] {else} [img]{$ImagesDir}/tab_contact.gif[/img] {/if}</td> <td> {if $smarty.get.section eq "Password_Recovery"} [img]{$ImagesDir}/tab_help_.gif[/img] {elseif $smarty.get.section eq "Password_Recovery_message"} [img]{$ImagesDir}/tab_help_.gif[/img] {elseif $smarty.get.section eq "Password_Recovery_error"} [img]{$ImagesDir}/tab_help_.gif[/img] {elseif $smarty.get.section eq "FAQ"} [img]{$ImagesDir}/tab_help_.gif[/img] {elseif $smarty.get.section eq "about"} [img]{$ImagesDir}/tab_help_.gif[/img] {elseif $smarty.get.section eq "business"} [img]{$ImagesDir}/tab_help_.gif[/img] {elseif $smarty.get.section eq "conditions"} [img]{$ImagesDir}/tab_help_.gif[/img] {elseif $smarty.get.section eq "publicity"} [img]{$ImagesDir}/tab_help_.gif[/img] {else}[img]{$ImagesDir}/tab_help.gif[/img] {/if}</td> </tr> </table>

Works great!!
__________________
~zilker

uummm...perhaps you should tell me again.

http://www.designertrends.com
Version 4.0.6
Unix
Reply With Quote
  #4  
Old 01-10-2005, 10:42 PM
 
ghhoz ghhoz is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 40
 

Default

Thanks for sharing this code, it was looking for this same thing. Just one questions, what file do you edit for this code?

Thanks again and BTW your site you are developing looks great.
__________________
Cheers from Melanie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xcart V4.0.4 (Unix) - LIVE
AOM, Fancy Categories
Marketing Manager,
Reward Points & Refer Rewards
Advanced Site Map
Easy Checkout

Gift & Homeware House
www.giftandhomewarehouse.com.au
Reply With Quote
  #5  
Old 01-11-2005, 07:56 AM
 
zilker zilker is offline
 

Advanced Member
  
Join Date: Feb 2003
Posts: 89
 

Default

I inserted that into the head.tpl file although it can be placed in any file. Let me know if I can do anything else to help you.
__________________
~zilker

uummm...perhaps you should tell me again.

http://www.designertrends.com
Version 4.0.6
Unix
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:28 AM.

   

 
X-Cart forums © 2001-2020