Jump to content

If/else and page titles


Recommended Posts

I'm trying to get my nav tabs to highlight depending on which page its on.

 

Ive managed to do this using 2 techniques: {if $pagetitle == 'Client Area'} and {if $filename == 'domainchecker'} .

 

Ive managed to do this for majority of the pages BUT for the life of me i cant figure out how to do it for the domains and products page! The domains url is clientarea.php?action=domains so i dont know how to use the above if statements to get my nav to highlight...

 

Ive also got this issue with the products page. Again the page title and url state clientarea so the nav thats highlighted is clientarea.:roll:

 

I have the following nav tabs: home, client area, domains, products, support,affiliates and cart.

 

I have them all working apart from domains and products..

 

Any wise members able to help..

 

Hoping someone here has a solution for this.

Link to comment
Share on other sites

http://forum.whmcs.com/showthread.php?t=29124

 

Here you go... read all my post in this thread

 

Thanks for he link to the post.

 

Ive spent most of the day trying to sort this out and have managed to sort it out partially. I used {if $filename eq "clientarea" and $smarty.get.action eq "details"} and with that i can have my domains tab active HOWEVER i have split my tabs up like so:

 

>Client area

>>my details

>>add new contact

>>change security question

>my emails

>>manage contacts

>>change password

>>my invoices

 

and a few others that relate to the client details

 

My other tab is domains and products services. As both these pages have the clientarea.php link using the above if statement not only displays those tabs as current BUT also displays the client area tab as current. So i have 2 active tabs.. Whats the work around to this? I think if i could rename those page titles it would be much easier. So domains would be page titled domains or similar and products/services as such. That way i could use a simple if statment to show an active tab..

 

Those pages currently have client area page title so its clashing with the if statements that i have added...how can i change the page titles of the domain and product/services pages?:|

Link to comment
Share on other sites

This is what am using for HostBill
<li>
	<a {if $cmd=='checkdomain' && $action!='transfer' && $action!='bulk'}class="now" {/if}href="{$ca_url}checkdomain/" title="Register Domain">Register Domain</a>
</li>
<li>
	<a {if $cmd=='checkdomain' && $action=='bulk'}class="now" {/if}href="{$ca_url}checkdomain/bulk/" title="Bulk Domain Search">Bulk Domain Search</a>
</li>
<li>
	<a {if $cmd=='checkdomain' && $action=='transfer'}class="now" {/if}href="{$ca_url}checkdomain/transfer/" title="Transfer Domain">Transfer Domain</a>
</li>

for WHMCS

I think is like this

<li>
	<a {if $filename eq "domainchecker" && $search!='bulktransfer' && $search!='bulkregister'}class="now" {/if}href="domainchecker.php" title="Register Domain">Register Domain</a>
</li>
<li>
	<a {if $filename eq "domainchecker" && $search=='bulktransfer'}class="now" {/if}href="domainchecker.php?search=bulktransfer" title="Bulk Domain Search">Bulk Domain Search</a>
</li>
<li>
	<a {if $filename eq "domainchecker" && $search=='bulkregister'}class="now" {/if}href="domainchecker.php?search=bulkregister" title="Bulk Domain Transfer">Bulk Domain Transfer</a>
</li>

 

Check this code and play with. Am not using WHMCS anymore so I can test it..

 

Change search to action fro client area.

Link to comment
Share on other sites

  • 3 weeks later...

An update with the issue i was having.

 

Basically as my navigation was in UL tags it was giving an error where 2 nav tabs where being highlighted at the same time. I tried the following codes that were kindly provided by matt:

{if $pagetitle eq $LANG.clientareatitle && !$action}highlight client area page{/if}

 

And then for My Domains it should be:

 

{if $pagetitle eq $LANG.clientareatitle && ($action eq "domains" || $action eq "domaindetails"}highlight domains tab{/if}

 

And for products:

 

{if $pagetitle eq $LANG.clientareatitle && ($action eq "products" || $action eq "domaindetails"}highlight products tab{/if}

However at first this didnt work and then after comunicating with matt again he kindly provided the following which has sorted out my issue:

{if $pagetitle eq $LANG.clientareatitle && !$smarty.get.action}highlight client area page{/if}

{if $pagetitle eq $LANG.clientareatitle && ($smarty.get.action eq "domains" || $smarty.get.action eq "domaindetails")}highlight domains tab{/if}

{if $pagetitle eq $LANG.clientareatitle && ($smarty.get.action eq "products" || $smarty.get.action eq "domaindetails")}highlight products tab{/if}

So if anyone experiences the same issue and the if pagetitle OR if filename calls are not working perhaps the above codes may help you :)
Link to comment
Share on other sites

  • 10 years later...

this is fully custom pagetitle on whmcs 

 

     <title>
        
        
        
        {if $groupname}{$groupname}
    
    
    {elseif $templatefile  eq "configureproduct"}{$LANG.orderconfigure}
    {elseif $templatefile  eq "viewcart"}{$LANG.cartreviewcheckout}
    {elseif $templatefile eq 'checkout'}{$LANG.orderForm.checkout}
     {elseif $templatefile eq 'domainregister'}{$LANG.registerdomain}
     {elseif $templatefile eq 'configuredomains'}{$LANG.cartdomainsconfig}
          {elseif $templatefile eq 'configureproductdomain'}{$LANG.domaincheckerchoosedomain}
     
     
     
    {else}{$pagetitle}{/if}
    
    
    {if $kbarticle.title} - {$kbarticle.title}{/if} - {$companyname}
    
    
    
    </title>

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