| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Making Navbar Unique on Each Page | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() Hi All,
I'm wanting to add an active class to my navbar links. Obviously this class is only applied to the active page's li tag, so I need to be able to change my navbar depending on the page. I currently have my nav code located in head.tpl which is called from customer/home.tpl. Since all the pages use customer/home.tpl (other than the shopping cart pages which use modules/fast lane checkout/home.tpl), I'm having trouble thinking of a way to make the navbar unique on each page. I'm sure there must be a way with smarty templates, I'm just not very versed in their usage. Any help with adding an active class to a diff li element depending on the page would be MUCH appreciated! -Nick
__________________
v 4.1.11, v 4.2 |
|||||||
#2
|
|||||||||
|
|||||||||
![]() which pages do you have in teh nav bar?
__________________
xcart 5.1.2 |
|||||||||
#3
|
|||||||
|
|||||||
![]() My individual product pages, my contact page, and two static pages (also my shopping cart area, but that part I figured out because it uses a totally different template than the rest of my pages, so I made a unique head.tpl for that template which has the active class set properly for the shopping cart pages.)
__________________
v 4.1.11, v 4.2 |
|||||||
#4
|
|||||||||
|
|||||||||
![]() you are going to use if and elseif statements
MAKE SURE YOU BACK UP FIRST!!!!! {if $page_data.pageid eq 8} Your content {elseif $smarty.get.section eq "contactus"} your content {elseif $cat eq 381} your content {/if} replace the 8 with your page ids and 381 ith your cat id. this is a start. you will have to play with this to get it right. Ash
__________________
xcart 5.1.2 |
|||||||||
#5
|
|||||||
|
|||||||
![]() Awesome Ashley, thanks. I will play with some if else statements in my head.tpl file that includes my nav bar and see what I can come up with. Thank-you so much for your help!
-Nick
__________________
v 4.1.11, v 4.2 |
|||||||
#6
|
|||||||
|
|||||||
![]() It worked perfectly Ashley, Thank-you SO much!
__________________
v 4.1.11, v 4.2 |
|||||||
#7
|
|||||||
|
|||||||
![]() One last question - my active class works for when you have something in the shopping cart - because that's when it changes templates to the fast_lane_checkout template. When there's nothing in your cart however, the template is the same, therefore I need to write another elseif statement for the cart page. My attempts have been like this :
{elseif $page_data eq "cart"} {elseif $page_data eq "shoppingcart"} {elseif $page eq "cart"} {elseif $page eq "shoppingcart"} etc. etc. none of which have worked. I'm simply trying to get ahold of cart.php - any help is much appreciated!
__________________
v 4.1.11, v 4.2 |
|||||||
#8
|
|||||||||
|
|||||||||
![]() try $main eq "cart"
__________________
xcart 5.1.2 |
|||||||||
#9
|
|||||||||
|
|||||||||
![]() the page_data variable is only for static pages.
__________________
xcart 5.1.2 |
|||||||||
#10
|
|||||||
|
|||||||
![]() Perfection! Thanks Ash. I knew I had seen the cart referred to like that..just couldn't remember that $main portion. Worked like a charm!
__________________
v 4.1.11, v 4.2 |
|||||||
|
|||
X-Cart forums © 2001-2020
|