|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
jamminjames Smarty Rookie
Joined: 26 Dec 2018 Posts: 5
|
Posted: Wed Dec 26, 2018 11:40 pm Post subject: How to display form result in template including php vars? |
|
|
I would like to use a Smarty template to display php variables, which represent sql database text fields. I'd like it to also show the result of the Smarty assigned tags that are stored in those fields.
What I'm doing is giving the user an html form to fill out, which will serve as an email subject and body template they'll use for customers. It involves giving them the tags to use, such as {name}), and writing the results to the db. Then, I want to display the result for them to inspect, and have the tags rendered (e.g. {name} would show as the example "Name" that I have assigned to the tag).
How do I include the database info in the template? I can assign them php variables, like $subject = $row["subject"], but how do I render that in the template? I know we're not supposed to use {php} tags, but I'm having trouble writing a plugin that will do that. I figure someone must have tackled this already, so maybe I shouldn't be trying to reinvent that wheel.
Thanks for any help! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Dec 27, 2018 10:41 am Post subject: |
|
|
You should assign all data to template before rendering.
See documentation. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|