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

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

 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #1  
Old 02-03-2007, 07:09 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #2  
Old 02-04-2007, 03:19 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

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

Moving to Third Party Add-Ons
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 02-04-2007, 05:35 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #4  
Old 02-04-2007, 05:40 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 02-04-2007, 05:46 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #6  
Old 02-04-2007, 05:50 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #7  
Old 02-04-2007, 07:24 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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
__________________
xcartmods.co.uk
Reply With Quote
  #8  
Old 02-04-2007, 07:40 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #9  
Old 02-04-2007, 07:56 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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
__________________
xcartmods.co.uk
Reply With Quote
  #10  
Old 02-04-2007, 08:48 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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!
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4



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 08:04 PM.

   

 
X-Cart forums © 2001-2020