creating templates

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
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

creating templates

Post by shivam0101 »

How to create email templates and newsletter templates?

The admin can add, edit, delete them.

Thanks
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I'm not sure I understand the question.

You would create a template just like you would any other page. HTML/CSS. With place holders for the info that changes.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

If I understand your question you could create an "admin" page that allows users to create email "templates" using an editor such as FCKEditor or TinyMCE. These editors will create the HTML for you which can then be stored in a database as email templates.

In order to include dynamic content, simply add it to the source code.

When you want to send an email you can call a template and set it as the $message in mail().
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

Post by shivam0101 »

aceconcepts, you are right. Thats what i want. Instead of users admin himself create it. Later on he will select one of it and use it.

You mean to say only the html will be sent in message?

Should i have to add tags like header, footer, body etc? What dynamic content should he be given to add... i am confused
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

What I mean by dynamic content is content that is not static/constant i.e. date, person's name you are sending the email to.

All the editor will do for you is format the content you enter with HTML tags

e.g. if you enter something like "Hello this is a test email" as plain text without any additional formatting such as bold the editor will format your entry so that it looks like this:

Code: Select all

<p>Hello this is a test email</p>
In order to add dynamic content simply edit the source code ("Source" is provided on editor toolbar sets) and insert the PHP $variables you want.

e.g. When you edit the source code to add your $variables it will look something like this:

Code: Select all

<p>Hello <? echo $name_of_person; ?> this is a test email</p>
The value of variable $name_of_person will be picked up from your PHP scripted used to send the mail.

Does this help?
Post Reply