Jump to content

[v6] PHP Smarty code is not working properly.


Recommended Posts

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 by senseless
Link to comment
Share on other sites

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

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

Guest
This topic is now closed to further replies.
×
×
  • 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