Currently I am in a template and need {php} to read something from the Model/Database. This shall now be a new smarty variable within the current template. How do I solve this?
e.g.:
{php}
$var["newSmartyVar"] = model_gimme_data();
$currentTemplate->assign($var);
{/php}
The value is {$newSmartyVar} !
What’s the correct code here?
(Yee, uncommon and not abstract but only needed for rapid prototyping. The code will go in the Controller later on.)
$thisrefers to the current smarty instance:you should, however, avoid {php} like the plague. Using {php} is a sign of missing abstraction. You could look into creating a function plugin instead.