In general, if we have a Smarty project we assign variables in .php
file, and use the variables in its corresponding .tpl` file.
such as:
$smarty->assign('foo', 'Foo'); // in .php file
{$foo} // in .tpl file
can we define the variables in .tpl
? and if can, is this recommend?
and why?
Yes, you can:
{assign var="foo" value="Foo"}
{assign "foo" "Foo"} {* short-hand *}
The value of $foo is Foo.