I have a table named Template which I set my messages to send them via mail, I need php variables to input into.
My question is: can I use Smarty to edit my messages (they are in HTML code) after retrieving them from the table?
For example, I have:
$message = getMsgFromTable(Template);
$message has the type Text which contains php variables. Can I use Smarty to fill this variable like this?
$message = setVariableValueBySmarty($message);
Smarty can fetch the template and return its output instead of displaying it.
The
fetch()method does this, and that’s what you need:There’s also a paragraph in documentation that tell you how to use it to send mails 🙂
If you need to create template from the database (stored as string), take a look at this: