Jump to content

{if} statements and URL


mwbarker

Recommended Posts

I have 2 links in my menu pointing to WHMCS; is it possible to put logic into the header.tpl file that would determine if the current page is a specific page and change the menu based on that. In other words, my menu looks like this:

 

<li><a href="../clients/domainchecker.php"><span>DOMAINS</span></a></li>
<li><a href="../clients/"  class="current"><span>CLIENTS</span></a></li>

 

Is there any way to make it look like this?

 

{if currenturl=domainchecker.php}
<li><a href="../clients/domainchecker.php" class="current"><span>DOMAINS</span></a></li>
<li><a href="../clients/"><span>CLIENTS</span></a></li>
{else}
<li><a href="../clients/domainchecker.php"><span>DOMAINS</span></a></li>
<li><a href="../clients/" class="current"><span>CLIENTS</span></a></li>
{/if}

 

In other words, determine if the current URL points to domainchecker.php and if so, apply class="current" to it; otherwise, apply it to the CLIENT link?

Link to comment
Share on other sites

I have 2 links in my menu pointing to WHMCS; is it possible to put logic into the header.tpl file that would determine if the current page is a specific page and change the menu based on that. In other words, my menu looks like this:

 

<li><a href="../clients/domainchecker.php"><span>DOMAINS</span></a></li>
<li><a href="../clients/"  class="current"><span>CLIENTS</span></a></li>

 

Is there any way to make it look like this?

 

{if currenturl=domainchecker.php}
<li><a href="../clients/domainchecker.php" class="current"><span>DOMAINS</span></a></li>
<li><a href="../clients/"><span>CLIENTS</span></a></li>
{else}
<li><a href="../clients/domainchecker.php"><span>DOMAINS</span></a></li>
<li><a href="../clients/" class="current"><span>CLIENTS</span></a></li>
{/if}

 

In other words, determine if the current URL points to domainchecker.php and if so, apply class="current" to it; otherwise, apply it to the CLIENT link?

 

 

{if $smarty.server.PHP_SELF == '/domainchecker.php'}
<li><a href="../clients/domainchecker.php" class="current"><span>DOMAINS</span></a></li>
<li><a href="../clients/"><span>CLIENTS</span></a></li>
{else}
<li><a href="../clients/domainchecker.php"><span>DOMAINS</span></a></li>
<li><a href="../clients/" class="current"><span>CLIENTS</span></a></li>
{/if}

 

OR

{if $pagetitle == 'domainchecker'}
<li><a href="../clients/domainchecker.php" class="current"><span>DOMAINS</span></a></li>
<li><a href="../clients/"><span>CLIENTS</span></a></li>
{else}
<li><a href="../clients/domainchecker.php"><span>DOMAINS</span></a></li>
<li><a href="../clients/" class="current"><span>CLIENTS</span></a></li>
{/if}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated