![]() |
PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
I am using a modified vesion of PhilJ's advanced Speedbar.
My goal is to get each TAB to HIGHLIGHT if it is the ACTIVE location. This is something PhilJ built into the code, but I decided to not use the {section name=sb loop=$speed_bar} -- rather, I am using a hard coded version for all my static pages. SO -- this killed the highlight active tab feature (excpet for the hard coded pages that are obvious...) So, for example, my home page link looks like this: http://www.mommymakeup.com Code:
<li {if $main eq "catalog" && $current_category.category eq ""}id="current"{/if}><a href="/" title="Home"><span>Home</span></a> I was able to figure out how to get the Gift Certificates link to work: Code:
<li {if $main eq "giftcert"}id="current"{/if}><a href="/giftcert.php" title="Gift Certificates"><span>Gift Certificates</span></a> Now, my goal is to have the rest of my static pages tell smarty who they are, so that I can trap for {if $main eq "current-page-name"}id="current"{/if} For example, how would I take this link and tell smarty that it is the current page? Code:
<li><a href="/help/tips-n-tricks.html" title="Tips-n-Tricks"><span>Tips-n-Tricks</span></a> Note: I am using CDSEO for static pages, and we no longer use pages.php -- it has been replaced with the CDSEO equivalent, for my store it is named help.php I think I need to assign some kind of var to each static page, so that I can trap for it and use smarty in the speedbar. Can someone please share how this is done? Another example: My page "tips-n-tricks.html" is actually a static embedded page, /pages.php?pageid=3 -- BUT CDSEO allows me to call it, tips-n-tricks.html -- my question is: HOW CAN I tell this page that I want it to be called (to smarty) $tipsntricks ? Phil? Jon? Thanks! Jeremy |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Moving to Third Party Add-Ons
|
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Padraic,
Had I phrased the question, "How can I tell smarty that a page is the current page, such as $main eq "thispage" " - would you have moved this to 3rd party? - this is really NOT about a 3rd party mod -- but overall Smarty. PhilJ just uses smarty in his code, and I have modified the daylights out of it and it has very little basis on Phil's code... My question is realy about smarty and how a page tells smarty who it is. I would hate for forum members to think this is specifically a 3rd party issue... it's about smarty. Can I re-post the question wihtout the reference to PhilJ's code and try again? Thanks, Jeremy |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Both the subject and the body reference Phil's Speedbar...so naturally, I moved it to third party add-ons. In addition, you seemed to address the question to both Phil and Jon...why wouldn't I move this to Third Party Add-ons? :)
|
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
OK -- please let it live for now -- if this doesn't get any attention in the next day(s) I'll re-post with a rewriteen question - and you can delete this, ok?
|
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Your call...if it is not about a third party mod, I'll gladly move it to Template Editing...but it seems to address two specific third-party mods, no?
|
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Does this work?
Code:
{if $main eq "pages" and $page_data.pageid eq "3"}id="current"{/if} The mod does cater for static pages, it's explained in install.txt |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Quote:
Yeah baby! You rock!! :) I read through install.txt again, but I missed this... I may have a very old version, Phil... My copy of Speedbar was from when you were selling it (not the free version). All I have in my install.txt is: Quote:
My issue is that I am not using the speedbar "automatic" fucntions -- and I am hard coding each link, so this does not apply. If I use the automatic code, I lose some flexibility (and CDSEO breaks) - so to keep my URLs that CDSEO makes for me, I chose to hard code the links. AND I like the flexibility. I gladly accept the responsibility that comes with hard-coding links. THANK YOU for coming up with this solution! PS -- how did you know this smarty var ($page_data.pageid eq) ? How could I have found this for myself? Thanks! Jeremy |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
In smarty.php (located in your root folder)...
Change... Code:
$smarty->debug_tpl="file:debug_templates.tpl"; Code:
$smarty->debug_tpl="file:debug.tpl"; |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Quote:
Cool... thank you. Then, you have to take a wild guess at the correct syntax For example, in webmaster mode, I can see the page_data and pageid vars -- so I guess it's just knowing how to assemble vars -- I've been reading the smarty doscs until my brain explodes, but I'll keep at it. Thanks for pointing me in the right direction. Everything works as desired now! |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Quote:
wow that helps me out a ton... thanks :) |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
One way you can assign things is to set anew variable in the php files.
There are not too many main php files that control everything else. In the bottom of your php file add something like this Code:
$smarty->assign("sub", "my_page_name"); now in your template use this Code:
{if $sub eq my_page_name} Its basically just allowing you to assign your own variable instead of using the built in {$main} one that xcart uses |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
Shan,
I almost get it... So in my case, the static embedded pages are all related to what was pages.php (now for me, due to CDSEO, help.php) So in the php fie. I would add the line, $smarty->assign("sub", "my_page_name"); I could call "sub" anything I want, yes? What about "my_page_name" ? Does this have to match something in my static page? Do I add a line to the static page that tells smarty its page name? And finally, I would do this for EACH page, yes? Thanks! Jeremy |
Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
hi,
sub is the name of the variable i chose my_page_name is what we assign to that variable I was making a css nav menu and wanted to show what section i was currently in. eg help / products / checkout etc so in help.php i would add assign sub to help etc. this just allowed me to know what area of the site i was on as well as already having the value of {$main} if I needed to help.php - deals with help type stuff products.php & product.php dealt with most of the shop side of things cart.php was mainly the checkout stuff and so on |
All times are GMT -8. The time now is 07:18 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.