Email a Friend
Author: Artur Tomusiak
This document explains how to install an e-mail a friend service in CMS. It assumes that you have a web server that supports PHP or .NET and that you are comfortable with Cascade. Your version of Cascade Server needs to be at least 4.4. Knowledge of PHP and .NET is also useful, but not necessary to use this guide.
Please follow these steps to install the script.
1. Create a data definition for the configuration page:
Create a new data definition and copy and paste the content of the file "email-friend-config-data-definition.xml".
2. Create a configuration page and an index block that will show the page's content:
a) Create a new page with a name of "email-friend-config", let's say in: /test/files/email-friend-config.b) Select the data definition you created in step #1 and check "Use Data Definition".
c) Create a new Index Block, let's say in /test/_internal/blocks/configuration.
d) As an "Index Folder", select the folder in which the configuration page is (in our example, it is in /test/files/).
d) Choose Depth of Index: 1
e) Choose Indexed Asset Types: Pages
f) Choose Page XML: Render page XML inline
g) Choose Indexed Asset Content: Regular Content
Please make sure that you did not misspell the name of the config page. It has to be exactly same name as given above.
3. Import an icon image file:
Import the file "email-friend-icon.gif" to any directory, let's say to /test/files. It will be used as an icon asking the user to send an email to a friend. It can be any image of your choice, or the one provided here.4. Create the icon XSL stylesheet:
Create a new stylesheet, let's say in /test/_internal/stylesheets/icon and copy and paste contents of the file "email-friend-icon.xslt" to it.5. Add a region to your templates, in which an "email a friend" icon will appear. Type in:
<system-region name="EMAIL-FRIEND-ICON"/>6. Add the icon block and stylesheet to your configuration set:
a) In your configuration set, in the EMAIL-FRIEND-ICON region, as a block, select the index block you created in step #2c) (in our case it is /test/_internal/blocks/configuration).b) In the same EMAIL-FRIEND-ICON region, as a stylesheet, select the icon stylesheet you created in step #3.
7. Create the form XSL stylesheet:
Create a new stylesheet, let's say in /test/_internal/stylesheets/form and copy and paste contents of the file "email-friend-form.xslt" to it.8.Create the form page:
a) Create a new template, select your target, and copy and paste the content of the file "email-friend-template.xml" to it.b) Create a new Configuration Set with a configuration that will use the template. As a block, select the index block you created in step #2c) (in our case it is /test/_internal/blocks/configuration). As a stylesheet, select the form stylesheet you created in step #7.
c) Create a new page, let's say in /test/index and apply your new configuration set to it.
d) Publish the page.
The page might look too big in your CMS but it will look smaller after publishing and viewing from the published server.
9. Import the PHP or .NET script that will send the email:
a) Import the file "email-friend-send.php" or "email-friend-send.cs" to any directory, let's say to /test/files.b) Publish the file.
10. Change the configurations in your configuration page:
a) Edit your configuration page you created in step #2.
b) As "Image/Icon that will be a link to the Email-Friend Form", select the icon you imported in step #3.
c) As "Page with a form", select the page you created in step #8.
d) Type in email address from which the emails will be sent
e) As "PHP/.NET script that will send the email", select the PHP script you imported in step #9.
f) As "Default content of the email (will show on the form as default value)", type in the default text that will appear when the form pops up.
Example Files
- email-a-friend-PHP.zip
This zip file contains all the necessary scripts and XML files for PHP. - email-a-friend-NET.zip
This zip file contains all the necessary scripts and XML files for .NET. - email-friend-template.xml
This is an example email a friend template. - email-friend-send.php
This is the PHP script to process the email a friend form. - email-friend-send.aspx.cs
This is an example .NET code behind to process the email a friend form. - email-friend-send.aspx
This is an example .NET page for emailing a friend. - email-friend-icon.xslt
This is an example XSL to output a clickable icon for emailing a friend. - email-friend-icon.gif
This is an example email a friend icon. - email-friend-form.xslt
This is an XSL to display a form on a page to email a friend. - email-friend-config-data-definition.xml
This is an example data definition to visually configure the XML config file.