Jump to content

Sticky Navigation?


ByteRack

Recommended Posts

Any way to make this happen?

 

I would usually put something like this at the top of each page to identify the page.
<?php $thisPage="clientarea";?>

Then add this piece of coded to the link so it's highlighted when your on that particular page.

<li <?php if ($thisPage=="clientarea") echo " class=\"selected\""; ?>>[url="clientarea.php"]Client Area[/url]


<ul>
 [*][url="index.php"]Support[/url]
 <li class="selected">[url="clientarea.php"]Client Area[/url]
 [*][url="knowledgebase.php"]Knowledgebase[/url]
 [*][url="supporttickets.php"]Support Tickets[/url]
 [*][url="announcements.php"]Announcements[/url]
 [*][url="downloads.php"]Downloads[/url]
 [*][url="contact.php"]Contact Us[/url]
[/list]


Is there anything pre-existing I could hook into to identfy what page the user is on. I realize I can't place <?php $thisPage="clientarea";?> on each page. I also thought of using the body tag, but didn't seem possible either.

Link to comment
Share on other sites

How would I put this into the header.tpl correctly?

 

I tried putting it between {php}{/php} and nothing. Just leaves it blank.

 

 

<li class={php} if ($_SERVER["PHP_SELF"]=="clientarea.php") { echo "selected"; } {/php}>[url="clientarea.php"]{$LANG.clientareatitle}[/url]

Link to comment
Share on other sites

Well what youve got is if the if statement returns false, then the [*] tag looks like this:

 

<li class=>[url="clientarea.php"]{$LANG.clientareatitle}[/url]

 

Which is wrong.

 

Why dont you do:

 

{php}
if($_SERVER["PHP_SELF"] == "clientarea.php") {
     echo "<li class=\"selected\"><a href=\"clientarea.php\">{$LANG.clientareatitle}</a>";
} else {
     echo "[*]<a href=\"clientarea.php\">{$LANG.clientareatitle}</a>";
}
{/php}

Link to comment
Share on other sites

PHP is allowed but i appears you are pulling TPL variables which would require another command. Try the following code:

 

{php} 

if ($_SERVER["PHP_SELF"] == "/clientarea.php") { 
    echo "<li class=\"selected\"><a href=\"clientarea.php\">Client Area</a>"; 
} else { 
    echo "<a href=\"clientarea.php\">Client Area</a>"; 
} 
{/php}

Link to comment
Share on other sites

  • WHMCS CEO
Thanks guys, but I still can't get it working. I keep getting blank pages when I use the above code. I think the curly brackets in the PHP code are interefering with the smarty templates.

You definately can use PHP code in the templates and the curly brackets inside {php} and {/php} tags will not cause errors. A blank page will mean there is an error in the code you have entered.

Link to comment
Share on other sites

You guys rule! There were errors or blank spaces from copying the code from the forum. I re-typed and it worked perfect.

 

Live example, still under construction:

w w w .byterack.net/support/clientarea.php

 

Here's what ended up working for me:

{php}
if ($_SERVER["PHP_SELF"] == "/support/clientarea.php") {
echo "<li class=\"selected\"><a href=\"clientarea.php\">Client Area</a>";
} else {
echo "[*]<a href=\"clientarea.php\">Client Area</a>";
}
{/php}

 

 

Is there any way to use {$LANG.clientareatitle} so language switching still works. I tried to use it the above code and got a blank page.

 

Thanks again!

Link to comment
Share on other sites

I ended up using this, works perfect and allows {$LANG.clientareatitle} to be used.

 

<li {if $smarty.server.PHP_SELF == "/support/clientarea.php"}class="selected"{/if}>[url="clientarea.php"]{$LANG.clientareatitle}[/url]

 

I'm still trying to figure out how to make it work with clientarea.php?action=details links.

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