Monday, 15 June 2015

php - Smarty variable expansion -



php - Smarty variable expansion -

if have ($abc} in smarty template file, $abc has been constructed in php using nowdoc syntax as,

$abc = <<<'eot' $key eot

is there way smarty fist expand $abc, , expand within $abc, i.e. expand $key well. right string literal $key in output, not within of $key.

reason doing this

i have snippets copied on place. place these tpl snippets in files of own, leads explosion of files. have single file contains these snippets. cannot include big mutual snippet file everywhere. ended constructing php file has these snippets, , utilize variables @ places need.

you utilize smarty's eval-function, php documentation says "no parsing done within nowdoc".

could utilize heredoc instead?

<? $key = 'something'; $abc = <<<eot $key eot; // {$abc} print something; ?>

php smarty

No comments:

Post a Comment