Ideas for creating an e-mail template web app.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Ideas for creating an e-mail template web app.

Post 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,
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Templates are files. Use the filesystem to allow uploads of templates.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why not use an existing template engine, or XSLT?
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post 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,
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I am a big Template Lite proponent. If you are going to choose either one, I would suggest Template Lite over Smarty.
Post Reply