CGI Programming by Collin Forbes
  Templates for Postcards 2.5   Updated: Thur, 20 Apr 2000  

There are five templates with separate functions
Templates are normal HTML (or text files) which contain marker tokens telling the postcard.cgi program where to put the special values. You can change the filenames for each template in the [template] section of the postcard configuration file

initial-template
This is the main postcard form with inputs for the name and address, of the recipient and sender, and a textarea to write the message.

%%TOKEN(form-top)%%

The opening of the form element.

%%TOKEN(image-url)%%

The URL of a representative image. This is intended to be either a thumbnail or an example of a completed postcard rather than the full-sized postcard image.

%%TOKEN(sender-address-input)%%

The form input for the sender's email address.

%%TOKEN(sender-name-input)%%

The form input for the name of the sender. You can omit this and the postcard will still make sense and function properly.

%%TOKEN(recipient-address-input)%%

The form input for the email address of the recipient.

%%TOKEN(recipient-name-input)%%

The form input for the name of the recipient. Like the sender's name, you can omit this without anything weird happening.

%%TOKEN(message-textarea)%%

A textarea for the postcard message. Pre-sized to 50x5.

%%TOKEN(submit-button)%%

The submit button for the form. You could pair this with a hard-coded reset button or a javascript link to go back. If you'd like to use an image as a submit button, omit this token and hard code the submit button into the template.

%%TOKEN(form-end)%%

The closing tag of the form element.

confirm-template
This page shows the user the completed postcard image and asks them if they really want to send it.

%%TOKEN(postcard-src)%%

The URL of the completed postcard.

%%TOKEN(postcard-width)%%

The width of the completed postcard image in pixels. Feel free to hard-code this if you already know the size.

%%TOKEN(postcard-height)%%

The height of the completed postcard image in pixels. Feel free to hard-code this if you already know the size.

%%TOKEN(send-url)%%

The URL to use to send this postcard. The link you make should be paired with either a javascript "go back" link or instructions to use the back button to go back to the previous form if they'd like to make changes.

problem-template
This page tells the user they've made a mistake with one or both of the email addresses. It still shows them the completed postcard, but with no option to send. Add instructions to correct the error using the back button, or provide a javascript "go back" link.

%%TOKEN(postcard-src)%%

The URL of the completed postcard.

%%TOKEN(postcard-width)%%

The width of the completed postcard image in pixels. Feel free to hard-code this if you already know the size.

%%TOKEN(postcard-height)%%

The height of the completed postcard image in pixels. Feel free to hard-code this if you already know the size.

sent-template
This page tells the user the postcard has been sent. The completed postcard is a final reminder of what they sent. You should add some additional navigation away from this page, as it is otherwise something of a dead-end.

%%TOKEN(postcard-src)%%

The URL of the completed postcard.

%%TOKEN(postcard-width)%%

The width of the completed postcard image in pixels. Feel free to hard-code this if you already know the size.

%%TOKEN(postcard-height)%%

The height of the completed postcard image in pixels. Feel free to hard-code this if you already know the size.

email-template
This template is intended to be raw, plain text instead of HTML. It's the headers and body of the MIME-enabled file-attachment email message which will go out to the postcard recipient. You want to change the greeting message, but that's about it unless you know what you are doing (or are willing to learn).

%%TOKEN(sender-address)%%

The email address of the sender for the From: line of the header.

%%TOKEN(sender-name)%%

The name of the sender for the From: line in the header or for use in the body greeting. You can leave this out if you didn't ask for their name in the postcard form.

%%TOKEN(recipient-address)%%

The email address of the recipient for the To: line of the header.

%%TOKEN(recipient-name)%%

The name of the recipient for the From: line in the header or for use in the body greeting. Like the sender-name token, you can leave this out if you didn't ask for it in the form.

%%TOKEN(x-headers)%%

A set of diagnostic X-headers for the message. If someone complains of postcard abuse, have them send the entire message to you (including the headers). You should have enough information to start tracking the villian.

%%TOKEN(mime-type)%%

The MIME content-type of the postcard. It will be either image/gif, image/jpeg or image/png.

%%TOKEN(extension)%%

The filename extension of the postcard. Either gif, jpg or png.

%%TOKEN(encoded-image)%%

The postcard image as many hundreds of lines of base64 encoded data.