Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Gaining $current_url from dynamic urls | top_menu.tpl Rate Topic   - - - - -

 

Posted 16 July 2007 - 12:36 PM #1

top_menu.tpl
Skin: Default Blue 1.3.4 Sp3

{* VIEW CART *}
            <td width="2">
                <img src="{$images_dir}/top_menu_delim.gif" width="2" height="30" border="0" alt=""></td>
            <td width="{$tab_width}" align="center" {if $current_url == "$index_script?$target_name=cart"}style="background-image: url('{$images_dir}/top_menu_bg_active.gif');" class="top-menu-bg-active"{else}class="hand" onClick="javascript:self.location='{$index_script}?{$target_name}=cart'"{/if} nowrap>
                <a href="{$index_script}?{$target_name}=cart" class="top-menu-title">{$lang.view_cart}</a></td>

Can anyone explain how to 'decode' common URLs to smarty coding?
I need a single topic page to be classified as the $current_url in order to get the 'pushed button' impression on the menu.

http://www.domain.com/index.php?target=topics&topic_id=14
{if $current_url == "$index_script?target=topic_data&topic_id=14"}

http://www.domain.co...name=contact_us
{if $current_url == "$index.php?target=forms&name=contact_us"}

I've tried the following without success:
{if $current_url == "$index_script?$target=$topic_data&topic_id=14"}

Eg Click on 'view cart' from the top navigation menu on the cs-cart demo,
the button will then go light blue with the others being the default solid state colour.

If anyone's got any ideas it would be much appreciated to reply :D
Jesse
I've moved on from CS-Cart to WooC******** - If you need anything I can be of little help.

 
  • bholland
  • Senior Member
  • Members
  • Join Date: 16-May 06
  • 129 posts

Posted 21 July 2007 - 02:50 AM #2

Jesse,

I'm not in front of my development environment right now, but why not check your debug window and see what's being set in $current_url when you're on that page?

B

 
  • TonyK
  • Member
  • Members
  • Join Date: 03-Mar 06
  • 1686 posts

Posted 21 July 2007 - 03:31 AM #3

Im not sure exactly what your trying to do, but you got variables all over the place and is confusing to me what you want.

http://localhost/csc...php?target=cart
produces the variable below:
{$current_url} = index.php?target=cart
Pimpin' skins since v1.0

 

Posted 21 July 2007 - 09:44 AM #4

Im not sure exactly what your trying to do, but you got variables all over the place and is confusing to me what you want.

http://localhost/csc...php?target=cart
produces the variable below:
{$current_url} = index.php?target=cart


That's more or less what I required except, when the page loads the variable won't load as it's php, not smarty :P I got confused beyond definition however I'll show you all what I was aiming for. Worked too :D


As you can see the red coding is what really confused the **** outta me.
And so, I needed three different URL strings to signify what page I was on when I clicked on the buttons.

{* CONTACT US *}
            <td width="2">
                <img src="{$images_dir}/top_menu_delim.gif" width="2" height="30" border="0" alt=""></td>
            <td width="{$tab_width}" align="center" {if $current_url == "[COLOR=Red]$index_script?target=forms&name=contact_us[/COLOR]"}style="background-image: url('{$images_dir}/top_menu_bg_active.gif');" class="top-menu-bg-active"{else}class="hand" onClick="javascript:self.location='[COLOR=Red]{$index_script}?{$target_name}=forms&name=contact_us[/COLOR]'"{/if} nowrap>
                <a href="[COLOR=Red]index.php?target=forms&name=contact_us[/COLOR]" class="top-menu-title">{$lang.contactus}</a></td>
            <td width="2">
                <img src="{$images_dir}/top_menu_delim.gif" width="2" height="30" border="0" alt=""></td>

I've moved on from CS-Cart to WooC******** - If you need anything I can be of little help.

 
  • TonyK
  • Member
  • Members
  • Join Date: 03-Mar 06
  • 1686 posts

Posted 21 July 2007 - 01:20 PM #5

{* CONTACT US *}
<td width="2">
<img src="{$images_dir}/top_menu_delim.gif" width="2" height="30" border="0" alt=""></td>
<td width="{$tab_width}" align="center" {if $current_url == "index.php?target=forms&name=contact_us"}style="background-image: url('{$images_dir}/top_menu_bg_active.gif');" class="top-menu-bg-active"{else}class="hand" onClick="javascript:self.location='index.php?target=forms&name=contact_us'"{/if} nowrap>
<a href="index.php?target=forms&name=contact_us" class="top-menu-title">{$lang.contactus}</a></td>
<td width="2">
<img src="{$images_dir}/top_menu_delim.gif" width="2" height="30" border="0" alt=""></td>
Pimpin' skins since v1.0

 

Posted 21 July 2007 - 01:23 PM #6

the top one is actually working :P
thanks for the code regardless.

It was a matter of & since html escape characters must be used in php?
I've moved on from CS-Cart to WooC******** - If you need anything I can be of little help.