msaunders Posted May 3, 2016 Share Posted May 3, 2016 Hello Am in the process of upgrading to V6.3 from V5 and making changes to our default V5 template. I had an IF statement I was using to display info in the client area specific to a tld if $tld eq "ie" Now it seems the variable $tld is no longer being used in V6 , am I correct ? I stuck a {debug} at the top of the page and its not listing $tld or $sld as an available option anymore. Any ideas how I can obtain that info in V6 easily without having to write a hook ? TIA Martin 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 3, 2016 Share Posted May 3, 2016 Hi Martin, which clientarea page are you looking at to do this in ? there are many pages to choose from and some might have a usable variable, others not! e.g., if it was clientareadomaindetails.tpl, then you'd have access to $domain and from that you could use Smarty to get the TLD and display the appropriate message. 0 Quote Link to comment Share on other sites More sharing options...
msaunders Posted May 3, 2016 Author Share Posted May 3, 2016 Hi Brian Thanks for the reply! Yes its in clientareadomaindetails.tpl and the variable is there in V5 of WHMCS but not V6 . Appreciate your help. Tks Martin 0 Quote Link to comment Share on other sites More sharing options...
msaunders Posted May 4, 2016 Author Share Posted May 4, 2016 Anyone have any idea how to achieve this ? Thanks ! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 5, 2016 Share Posted May 5, 2016 Hi Martin, sorry - from your reply, I got the impression that you knew how to do it! the quick way, if this is for an Irish domain, would be to simply check if the domain contains '.ie' - unless you're offering 4th level domains, or something where '.ie' could appear other than the end, then this should be sufficient... {if $domain|strstr:'.ie'} message {/if} for other TLDs, you might need to specifically check that the substring is at the end of the variable, and not just anywhere in the variable. for your purpose, what you might find more convenient is to split $domain into $sld and $tld - that should allow you to use your previous {if} code from v5. {assign domsearch $domain|strpos:"."} {assign sld $domain|substr:0:$domsearch} {assign tld $domain|substr:($domsearch+1)} the above Smarty code is written for v6 (using Smarty3), it wouldn't necessarily work in v5 (using Smarty2) - so others wanting to do this in v5, would need to use the code I posted in the thread below. http://forum.whmcs.com/showthread.php?107379-using-php-in-domainoptions-tpl&p=440938#post440938 you'll now have two variables that you can use on the domaindetails page, {$sld} and {$tld} - so you should be able to use your previous code... {if $tld eq "ie"} message {/if} hope that helps! 0 Quote Link to comment Share on other sites More sharing options...
msaunders Posted May 5, 2016 Author Share Posted May 5, 2016 Hi Brian Thanks for this , and sorry for confusion . This appears to be working which is great but I am getting an additional error now Fatal error: Using $this when not in object context in /var/www/vhosts/mydevdomain/httpdocs/vendor/smarty/smarty/libs/SmartyBC.class.php(464) : eval()'d code on line 8 In my block of code I am referencing $this $domainid = $this->_tpl_vars['domainid']; $domainname = $this->_tpl_vars['domain']; Is there a replacement variable for $this ? Thanks again for your help, Regards Martin 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 5, 2016 Share Posted May 5, 2016 Hi Martin, I might need to see you entire code - but I get the impression that you're trying to do this in PHP i.e within {php} tags rather than purely in Smarty. at some point in the future, using {php} tags won't be an option in WHMCS - so if you can do it only using Smarty and drop the {php} tags, now would be a good time to start. however, if you have to, check out the documentation in the thread below. http://docs.whmcs.com/Version_6_Template_Migration_Guide#.7Bphp.7D_Block_Syntax 0 Quote Link to comment Share on other sites More sharing options...
msaunders Posted May 5, 2016 Author Share Posted May 5, 2016 Hi Brian Thanks for this , I substituted the code from the example and got a bit further but it highlighted other issues with my code - ill have to get a developer to look at it for me and follow up on your suggestions. Thanks for your help! Kind Regards Martin 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.