X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Third Party Add-Ons for X-Cart 4 (https://forum.x-cart.com/forumdisplay.php?f=45)
-   -   PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X" (https://forum.x-cart.com/showthread.php?t=28560)

carpeperdiem 02-03-2007 07:09 PM

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>
</li>


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>
</li>


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>
</li>


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

balinor 02-04-2007 03:19 AM

Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
 
Moving to Third Party Add-Ons

carpeperdiem 02-04-2007 05:35 AM

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

balinor 02-04-2007 05:40 AM

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? :)

carpeperdiem 02-04-2007 05:46 AM

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?

balinor 02-04-2007 05:50 AM

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?

PhilJ 02-04-2007 07:24 AM

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

carpeperdiem 02-04-2007 07:40 AM

Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
 
Quote:

Originally Posted by PhilJ
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


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:

When adding a static page to the speedbar, ensure the 'POS.' value for both speedbar AND static page, are the same value (order position).

eg.
About Us Speedbar Link - Sort Position 10
About Us Static Page - Sort Position 10


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

PhilJ 02-04-2007 07:56 AM

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";
to...
Code:

$smarty->debug_tpl="file:debug.tpl";
Then turn on Webmaster Mode. It'll display every smarty variable at your disposal :)

carpeperdiem 02-04-2007 08:48 AM

Re: PhilJ's Advanced Speedbar - Smarty question re: id="current" - $main eq "X"
 
Quote:

Originally Posted by PhilJ
It'll display every smarty variable at your disposal :)


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!


All times are GMT -8. The time now is 11:56 AM.

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