Difference between revisions of "Smarty 4"

From TMM Wiki
Jump to navigationJump to search
Line 3: Line 3:
 
Associative array keys are not automatically assigned as variables and logic like this will no longer work with Smarty4:
 
Associative array keys are not automatically assigned as variables and logic like this will no longer work with Smarty4:
 
<pre>
 
<pre>
$smarty->assign($condition_data);
+
<font color="red">$smarty->assign($condition_data);</font>
 
</pre>
 
</pre>
 
need to replace with:
 
need to replace with:

Revision as of 15:37, 11 November 2022

These changes will be required within any implemented smarty code when upgrading to Smarty 4.

Associative array keys are not automatically assigned as variables and logic like this will no longer work with Smarty4:

<font color="red">$smarty->assign($condition_data);</font>

need to replace with:

if(is_array($condition_data)) {
foreach($condition_data as $key => $value) {
			$smarty->assign($key, $value); //assign the associative array keys as variables in smarty, except periods
		}
	}