Subscribe - E-mail Alerts

NEWS & TIPS

  • Site Access Keys
  • Top: Alt+t
    Previous: Alt+,
    Next: Alt+.
    Up: Alt+;
    (Note: use Ctrl on the Mac)

Subscribe - E-mail Alerts

Author: Artur Tomusiak

This document explains how to install a subscribing and notifying service in Cascade Server. It assumes that you have a recent version of PHP installed on your web server and that you are comfortable with Cascade. Knowledge of PHP is also useful, but not necessary to use this guide.

Please follow these steps to install the script.

1. The file extension of all your pages must be .php

2. First, you need to import subscribe-users.xml.php file somewhere in the system. Let's say it is /test/files/ folder. Publish the file. After publishing, uncheck the "Include when publishing" option so the file doesn't get published anymore in future but it stays in the CMS.

3. The file subscribe.php is used as the contents of a block. Create a new XML Block (let's say /test/_internal/block/subscribe) and copy and paste the contents of subscribe.php file into it. When creating the block, you need to change the fourth line of the code where it says:

  $configFileName = ...;

You need to add a full path of the subscribe-config.xml page and you need to make sure that [system-asset:page] tags are around it. For example, if you imported subscribe-config.xml file to /test/files/ folder, the line should  look like this:

  $configFileName = "[ system-asset:page ]/test/files/subscribe-config.xml[ /system-asset:page ]";

This block will have to have its place in a template, so in your template, you need to create a new region for this block. In that region, select the block you just created.

4. Create a data definition of any name and copy and paste the content of the file subscribe-config-data-definition.xml as the code of the data definition.

5. Create a new page somewhere in the system, let's say in /test/files/subscribe-config.xml and apply the new data definition. Also, apply the configuration set you just created. Edit the page and enter the "from" email address, for example "company@domain.com". Please click Submit. This is our configuration page. Publish it. Anytime you change it, you need to republish it.

6. Import the subscribe-data-sync.php file into the system. It must be in a main folder, for example in /test/. After importing, edit it and in the third line of code give the full path for the subscribe-config.xml page name (similar way as #3). Also include the .php extension after the page name. In our case it will be:

    $configFileName = "[ system-asset:page ]/test/files/subscribe-config.xml[ /system-asset:page ].php";

Also, make sure to turn the option on for rewriting links. Please publish that file.

7. Now, you need to create the pages with your template. You should see the block you created in #3 in those pages. After that, publish them and make the subscribe-data-sync.php file to run every night from the published server through a cronjob.

Subscribe Files 

  1. subscribe-data-sync-php.txt
    The script to run on a daily basis to backup the list of subscribers in the CMS via web services.
  2. subscribe-php.txt
    The main code to process people subscribing to be notified with e-mail alerts whenever a page has changed.
  3. subscribe-config-data-definition.xml
    The data definition code to populate the XML config file.
  4. subscribe-users.xml
    An example XML file with users subscribed to web pages for e-mail alerts.
  5. subscribe-config-xml-php.txt
    This is an example XML config file for the script.
  6. subscribe-e-mail-alerts-PHP.zip
    This is a zip file that contains all the necessary XML and code to use the tool.
Last modified on Mon, 05 Nov 2007 11:01:01 -0500

Top / Up / Table of Contents