i have a php variable which has html/smarty code in it
$x='<a href="{$link}" >{$title}</a>';
This data is fetched from database , i want to evaluate it using smarty and put the output into a php variable (to print it out or to save it to the database again) .
Thanks
Edit :
i want the content of X to be evaluated using smarty , as if the content of x is stored in a file.tpl then $y=$smarty->fetch('file.tpl'); ... want to do it without the need to save the content of x into a file
If you're using Smarty 3, you can easily do it by
$smarty->fetch('string:'.$template_string);
or 'eval:'.$template_string
.
more about it in the manual
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With