senseless Posted July 14, 2015 Share Posted July 14, 2015 (edited) I have documented the issue on the thread here To summarize. If you create code in a {php} tag on a page and then later reference that code in another {php} tag on the SAME page -- the variables / code does not pass through. If you put a variable in one area of the site it's not possible to call it in another even if the php tags are on the SAME page. I attempted to set the variables to global and it had no affect. Edited July 15, 2015 by senseless Link to comment Share on other sites More sharing options...
senseless Posted July 15, 2015 Author Share Posted July 15, 2015 It seems that smarty variables set inside the php tag are also not readable anywhere on the page (though they do appear in the array). To confirm just place this code in any file for testing.. {php} $derp = 1; global $smarty; $smarty->assign('derp', $derp); {/php} {php} echo $derp; {/php} {$derp} The above code will output nothing to the browser. Link to comment Share on other sites More sharing options...
senseless Posted July 15, 2015 Author Share Posted July 15, 2015 (edited) Hooks to clientareapage to set smarty variables still work fine -- I ended up doing this in order to assign the smarty variables I needed. Edited July 15, 2015 by senseless Link to comment Share on other sites More sharing options...
WHMCS Nate Posted July 15, 2015 Share Posted July 15, 2015 Hello, As a general rule the {php} tag is a bad idea and we are trying to help as many customers move away from it as possible. It was disabled in Smarty3, our plan was to remove all support for it in WHMCS 6.0, but added the ability to toggle it back on to help users with backwards compatibility. The behavior you are noticing is described in the Smarty 3 documentation's Smarty2 BC doc: http://smarty-php.googlecode.com/svn/trunk/distribution/SMARTY_2_BC_NOTES.txt == {php} Tag ==The {php} tag is disabled by default. The use of {php} tags is deprecated. It can be enabled with $smarty->allow_php_tag=true. But if you scatter PHP code which belongs together into several {php} tags it may not work any longer. This is not a bug in the product, but a result of the move to Smarty 3. Have a great day, Nate C Link to comment Share on other sites More sharing options...
Recommended Posts