![]() v4.01 © Fantoosh Software 1998-2001 |
|
|
4. Sale template |
Paperweight Stationery Suppliers Inc. have decided to have a sale and would like to tell their customers about it!
In the database there is a table called tblProducts which stores the product description, price and a flag to indicate whether the product is in the sale or not.
| 1. | Go to the templates tab and select sale.htm and sale.txt respectively. |
| 2. | Go to Subscriber Selection SQL. On Test List HTML and Test List Text remove "Account_Balance>0" since we wish to send this email to everyone. Don't forget to click on "Test SQL Statement" for each - just in case you made a typo. |
| 3. | Go to the Send Mail tab and click "Prepare to Send Mail". Click on "Show Sample HTML" once it is displayed. |
| 4. | This time we see that the layout is very similar, but this time we have a list of products in the sale. |
| 5. |
Have a look at the template - sale.htm. We can see the SQL
Statement:
<~ SQL1 SELECT Product, Format(Price,'$#,###,##0.00') as FPrice FROM tblProducts WHERE OnSale=True ORDER BY Product ~> Which tells the system to pull out the Product description and price fields (formatted as US$) where the OnSale flag is set to true, and that it should order the list by the Product description. |
| 6.. | An interesting piece of code is the following block:
<~START1~> START and LOOP are used to repeat an area for every record retrieved by the appropriate SQL statement (in this case SQL1). i.e. if we had a second SQL statement called SQL2 we would use START2 and LOOP2. If you are familiar with HTML you will know that <tr> and </tr> are used to mark a row of a table. So for every record (product in this case) retrieved a row will be created in the table. |
| 7. | And that's all there is to it! Play around with the templates, and create your own! You will find it becomes very easy with a little practice. |