You get a bonus - 1 coin for daily activity. Now you have 1 coin

A Smarty variable isn't passed from head to body

Practice




I have this problem with smarty

in an html template with the standard structure


{aaa=5}
a1={aaa}


a2={aaa}


located in a single file
I pass variables into the smarty template beforehand, but for some reason they're only available up to the start of the tag, i.e. a1=5, but a2 is empty,

I even tried passing smarty variables through php, but nothing worked

tried passing it through php



tpl template


{php}$bbb=$smarty->getTemplateVars('моя не передающая переменная');{/php}


a3={php}echo $bbb;{/php}




but the script throws an error

echo $smarty->getTemplateVars('my'); - throws an error
echo $smatry->_tpl_vars['my']; - empty

the only option that comes to mind is to use javascript in the head tag

.....

.....

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

Terms: Running server side scripts using PHP as an example (LAMP)