Page 1 of 1

Ideas for creating an e-mail template web app.

Posted: Tue Apr 10, 2007 6:13 pm
by impulse()
I need to create an app that will allow users to create, edit and use e-mail templates. I have the idea of storing the templates in a MySQL DB with %1%, %2% etc for each part of the e-mail that needs to be replaced with user input and use str_replace on it. But I'm not how well this will work with users being able to create templates.

Has anybody creates something like this before? What do you believe will be the easiest way to go about it? It doesn't necessarily have to be stored as MySQL data, files on the server would be OK.

Regards,

Posted: Tue Apr 10, 2007 6:20 pm
by RobertGonzalez
Templates are files. Use the filesystem to allow uploads of templates.

Posted: Wed Apr 11, 2007 8:12 am
by impulse()
I took your advice and used the filesystem to store the template contents but I had to use MySQL storage as far as I could see for storing how many substitutes words were in a template.

I used the idea of putting %1% where users wanted their first replacable word and then an increment of number for each one after that. I know it's not very user friendly but I didn't see many other ways to do it.

Thanks for the help though, Stephen

Posted: Wed Apr 11, 2007 8:19 am
by feyd
Why not use an existing template engine, or XSLT?

Posted: Wed Apr 11, 2007 8:49 am
by impulse()
I never knew XSLT existed till just. Also I did search for existing applications but I couldn't find any. Maybe Google got out the wrong side of bed.

Either way it's complete now and working.

Regards,

Posted: Wed Apr 11, 2007 8:56 am
by feyd
Smarty is probably one of the most used template engines. Our own AKA Panama Jack has built Template Lite, which is similar, but lighter weight and has some added features.

Posted: Wed Apr 11, 2007 10:35 am
by RobertGonzalez
I am a big Template Lite proponent. If you are going to choose either one, I would suggest Template Lite over Smarty.