Web Crossing


Introduction

Installation & Upgrade

Web Crossing Features

Customizing & Scripting

UniqueIDs, Full Paths & URL Codes

Basic Customization

Server-Side Scripting

Web Crossing Template Language (WCTL)

WCTL Code Examples

Server-Side Scripting: Web Crossing JavaScript (WCJS)

User & Access Issues

Data Organization & Management

Performance Issues

Appendix

Site Map

WCTL Examples
Subscribing Members to a Mailing List

If you place the following WCTL in the header of a folder, registered members will be able to subscribe to the folder's mirrored mailing list, as described in Two-way Mailing List Mirroring.

Welcome to our forum!

%% if userName %%

Use the form below to subscribe to this folder's mailing list.<BR>

%% use listServerForm_ %%

%% else %%

I see you have not yet logged in yet. If you login, then you will see a form here allowing you to subscribe to this folder's mailing list!

%% endif %%


Here is macro listServerForm_ with explanations shown in the comment boxes.

%% macro listServerForm_ %%
<form method="POST" action="%% urlBase %%listServerProcess_@%% certificate %%@%%location%%">
<BR>
<input type=hidden name=listName1 value="webxharbor-talk">
<input type=hidden name=listName2 value="webxharbortalk-mirror-mirror">
<input type=radio name=action value="subscribe" checked>Subscribe<BR>
<input type=radio name=action value="unsubscribe">Unsubscribe<BR>
<input type=submit value=" OK ">
</form>
<P>
%% endmacro %%

  • This macro displays the form used by members to subscribe or unsubscribe to the mailing list.
  • The form is processed by a separate macro: listServerProcess_
  • There are two hidden fields: listName1 and listName2. listName1 contains the name of the mailing list to which subscribers send email. listName2 contains the name of the mailing list to which Web Crossing sends posted messages. The mailing lists have the same subscribers except Web Crossing's POP3 mailbox is not a member of listName2, in order to prevent duplicate messages from being sent back to Web Crossing, as described in the section on two-way mailing list mirroring


%% macro listServerProcess_ %%
<HTML>
<HEAD><title> Mailing List Service Center </title></HEAD>
<BODY %% background %%>
™@
%% set _message
"<requests@lists.webxharbor.com>" & crlf &
"To: requests@lists.webxharbor.com" & crlf &
"From: " & user.userEmail & crlf &
"Subject: " & form.action & " " & form.listName1 & crlf & crlf &
" " & crlf %%
%% email( _message ) %%
%% set _message
"<requests@lists.webxharbor.com>" & crlf &
"To: requests@lists.webxharbor.com" & crlf &
"From: " & user.userEmail & crlf &
"Subject: " & form.action & " " & form.listName2 & crlf & crlf &
" " & crlf %%
%% email( _message ) %%

  • This macro processes the form. You will need to replace the email address "requests@lists.webxharbor.com" with the requests address of your mailing list server.
  • Note that the macro uses form.action (which was either "subscribe" or "unsubscribe") and sends the correct command to the mailing list server. The ability of Web Crossing to process forms is extremely strong and flexible. Any field in the form is received by the processing macro and can be accessed by just specifying form.fieldname.
  • Similarly, form.listName1 and form.listName2 contain the values of the listName1 and listName2 text fields in the form.
  • _message is just a variable (you can name it anything you like) that contains an email message in standard Internet format.
  • When _message is all set the email command is used to mail the message. Web Crossing does this automatically using its own built in SMTP server. You can generalize this example to do any kind of form to email processing you need.


<P>
%% if form.action == "subscribe" %%
%% set action "request to subscribe" %%
%% else %%
%% set action "request to unsubscribe" %%
%% endif %%
™@
%% form.listName1 %% - Your %% action %% has been processed.
<P>
To return, click on the OK button below.
<P>
<a href="%% urlBase %%14@%% certificate %%@%% location %%"><img alt=" OK " border=0 src="%% siteImages %%/ok.gif" %% pictSizeButton %%></a>
</BODY>
</HTML>
%% endmacro %%

  • After processing the form you need to present a result page to the user. The rest of the form processing macro just sends text, HTML tags and the contents of WCTL variable to a web page.
  • action is a variable created to contain some appropriate text depending on the action taken by the form. It is used by entering
    %% action %% in the macro.
  • The <a href> tag at the end of the macro is a standard way of showing an OK button and letting the user return to the previous location.

Resources

Sysop docs:


WCTL Concept Reference Page


A Non-Programmer's Guide to Web Crossing
by Sue Boettcher and Doug Lerner

© 2000 Web Crossing, Inc.