|
|
Installation
- Unzip ecardphp.zip and copy files to your web server under a folder
with read and execute permission (default setting).
If your script folder does not have read permission, copy all .php files
under your script folder. Copy all .html, .css, .js and
image files to your HTML folder.
- Use a text editor such as Notepad and edit config.php.
- Change $default_fullpath for your domain name
and where the image files are, for example:
$default_fullpath = "http://www.YourDomain.com/image/";
- Change $default_path to the same as
$default_fullpath but without the
http://
and the domain name. (No change for default setting.) For example:
$default_path = "image/";
- Change $default_html_path to where the
HTML files are. (No change for default setting.)
Note this is the actual path not virtual path as on URL.
Either specifies a path from root, or a path relative to the script.
For example:
$default_html_path = "";
- Change $default_temp_path to a temp directory
with write permission. For example:
$default_temp_path = "/tmp/";
- Test the script by typing the URL to ecard.php to a browser, for example:
http://www.YourDomain.com/ecard.php
This will start script with the first set of demo HTML. To see the second demo type:
http://www.YourDomain.com/ecard.php?next_page=holiday
To see the third demo type:
http://www.YourDomain.com/ecard.php?next_page=demo3
List of files
| script files |
| ecard.php |
This is the main ecard script. |
|
| config.php |
This script stores default parameters.
You can edit this file to change domain name, path to your HTML templates,
path to image files and others options.
|
| HTML and image files |
| modify.html, preview.html, send.html, mail.html
|
HTML files for demo 1.
mail.html is the default HTML for email content. |
|
| holiday.html, holiday2.html, birthday.html, info.html, info2.html
view.html, view2.html, send2.html, mail2.html, viewcard.html |
HTML files for demo 2.
mail2.html is used as HTML template for email content. viewcard.html is the
HTML template for user to view a stored ecard.
|
|
| demo3.html, view3.html, send3.html, mail.html |
HTML files for demo 3.
mail.html is used as HTML template for email content.
|
|
| image/*.jpg |
ecard image files used by the 3 demos. |
|
|
|
How does the script work and why it will work on any HTML design
The script works by replacing certain words in your HTML template with data. And use
specific HTML element names to control page flow (which HTML page will show up next).
It also uses HTML elements with specific names to control options such as, whether
to store data so user can come view the ecard later, rather then sending the card
in email, or whether to allow HTML code in message.
How does it put data on my web page?
How do I control page flow?
Take a look at the first set of demo HTML code.
Notice some words in the HTML code are highlighted in red. For example, in modify.html:
<input name="to" value="_to">
This is the edit box where user enter the recipient's email address.
You want it to show the email they previously entered.
By placing "_to" as the value to this input element in your HTML template,
the ecard script will replace "_to" with what the user entered previously.
Note the name of this element has to be "to".
List of words ecard script will replace
| name |
value |
description and example |
| to |
_to |
Recipient's email.
Example: an edit box (modify.html)
<input name="to" value="_to">
Example: print recipient's email (send.html)
Ecard has been sent to _to.
|
|
| from |
_from |
Sender's email.
Example: an edit box (modify.html)
<input name="from" value="_from">
Example: print sender's email (send2.html)
Thank you _from.
|
|
|
_subject |
Display the subject: line of the email.
Example: (preview.html)
<td>Subject:</td>
<td>_subject</td>
|
|
| pic |
_pic |
Name of the image file chosen by user.
Example: show the image (preview.html)
<img name="pic" src="_fullpath_pic">
Example: passing it to the next page (preview.html)
<input type="hidden" name="pic" value="_pic">
|
|
| pic |
_checkpic_Name |
Replaced as "checked" for a radio button if pic is the same as
Name, otherwise it is blank.
Example: Make radio button checked if tree.jpg was selected (modify.html)
<input type="radio" name="pic"
value="tree.jpg" _checkpic_tree.jpg >tree</td>
|
|
| message |
_message |
Personalized message entered.
Example: an edit box (modify.html)
<textarea rows="10"
name="message">_message</textarea>
Example: passing it to the next page (preview.html)
<input type="hidden" name="message" value="_message">
|
|
| |
_message_display |
Personalized message displayed.
Example: print message (preview.html)
_message_display
Note: the difference between _message and _message_display is that,
_message is the raw data user entered, it is what you want to pass to next page.
While _message_display is what's actually shown on the ecard, might have
certain HTML tags taken away, depends on how you set your option.
|
|
|
_path |
Path (in URL) to image file. This can be a path from root,
or one relative to the script.
Example: Display image (modify.html)
<img src="_pathornament.jpg" height="100">
If _path is /image/
then _pathornament.jpg is
/image/ornament.jpg.
|
|
|
_fullpath |
Full path (in URL) to image file including http:// and your domain name.
Example: Display image in email content (mail.html)
<img name="pic" src="_fullpath_pic">
If _fullpath is
http://www.YourWeb.com/image/ and
_pic is ornament.jpg,
then _fullpathornament.jpg is
http://www.YourWeb.com/image/ornament.jpg.
Note when you send ecard in the content of email, image must have full path
for it to be displayed properly.
|
|
| action_Name |
|
Which page to go to after form is submitted.
Script will use Name.html as the next page template.
Example: Go to preview.html or send.html depends on which button was pressed. (modify.html)
<input type="submit" name="action_preview"
value=" Preview ">
<input type="submit" name="action_send"
value=" Send ">
|
|
| next_page |
|
Make link go to specific page.
Example: (holiday.html)
I am in a holiday ecard selection page (holiday.html).
I want a link in this page that will go to the birthday ecard selection page (birthday.html).
<a href="ecard.php?next_page=birthday">
Birthday</a>
|
|
| allow_tags |
List of HTML tags you allow user to put in message.
|
Specify the HTML tags you allow user to put in message, if they are different
then the default ones in config.php.
Example: Allow only <br>, <p> and <hr>(info.html).
<input type="hidden" name="allow_tags"
value="<br><p><hr>" >
|
|
| mailfile |
Name of HTML template for email content
|
Specify the name of the HTML file to be used as template for email content.
Example: (info.html) Default email template is mail.html. I want to use mail2.html instead.
But I cannot change it in config.php because I want the first demo (modify.html) to
send email using mail.html. So now I use this mailfile parameter to overwrite the default
for this particular demo site, and both will work as intended.
<input type="hidden" name="mailfile"
value="mail2.html" >
|
|
| send_link |
|
If this parameter is true, it store data in a log file and generate an ecard id,
so that user can come and view the email from web site later.
The parameter $default_temp_path in config.sys specifies the folder where
the log files are stored.
One file per day. Name of the log file is YYMMDD.crd (year-month-date).
Example: (info.html)
<input type="hidden" name="send_link"
value="yes" >
|
|
| ecard_id |
_ecard_id |
A unique ID for each ecard stored. If this parameter is specified,
stored user information will be retrieved before displaying next page.
Example: (mail2.html)
<a href=
"http://www.systems1001.com/ecard.php?next_page=viewcard&ecard_id=_ecard_id">
Click here to view your ecard.</a>
|
|
How do I make the script send out the email?
If the name of the HTML template starts with "send", such as "send.html", "send2.html"
or "sendanything.html", the ecard script sends out email before displaying the next page.
If send_link was specified, before displaying send*.html, it also store user information
in log file and generate ecard_id which is then accessible in send*.html.
How do I view stored ecard?
Make a HTML template of the web page user will see when they come view the ecard.
View it from ecard.php with that template and a give ecard_id. For example, if
HTML template is viewcard.html, and ID is 061201000000, then the URL would be
something like:
http://www.YourDomain.com/ecard.php?next_page=viewcard&ecard_id=061201000000
(see table above under "ecard_id".)
|
|