Is there a way to run PHP code in the templates? For example:
```php
if ($var = ‘static_value’) {
echo ‘
That is correct.
’;} ```
Is there a way to run PHP code in the templates? For example:
```php
if ($var = ‘static_value’) {
echo ‘
That is correct.
’;[quote name=‘smoked1’]Is there a way to run PHP code in the templates? For example:
```php
if ($var = ‘static_value’) {
echo ‘
That is correct.
’;
{include_php file="yourphpfile.php"}
Best Regards
Sweet. Thanks. Can that file also use the Smarty Variables?
[quote name=‘smoked1’]Sweet. Thanks. Can that file also use the Smarty Variables?[/QUOTE]
You are welcome!
I think it’s not possible, because in that file you are using only standard PHP…but I’m not totally sure (maybe it could be possibile to include smarty classes in that file…)
Regards
you can insert php code right into your tpl file without including a separate file by using the tags
{php}
your php code here
{/php}
You CAN also assign tpl variables to php like this:
{assign var=smarty_var_get value=$cart.total}
{php}
$price = $this->get_template_vars(‘smarty_var_get’);
{/php}