So
you want to know more about the Spd E-Letter, eh? Perhaps you would
like to integrate the subscription process into an existing form
or other registration system. Or maybe you would like to develop
additional scripts to handle the things we haven't covered. Here
you will find the knowledge from those who built the Spd E-Letter.
The information in this document is presented as easily as we could
make it without using too many technical terms and is written in
an informal tone. You will also need the developer_tools.zip
file that can be found in the admin directory for most of these
examples.
Table of Contents
=============================================================
1.) Introduction
2.) Subscribe Function
3.) Un-Subscribe Function
4.) Get Subscriber Function (1)
5.) Get Subscriber Function (2)
6.) Newsletter Archives
7.) Public Subscriber Edit
1.) Introduction
==============================================================
Thank you for purchasing the Spd E-Letter Mailinglist. For developers,
we have created several developer tools that will help you more
effectively integrate the Spd E-Letter into your website. Below
you will find basic explanations on how to use these tools on your
website. If you have any problems, you can get help from the PensaWorks
forum.
Please remember that we cannot debug all of your custom scripts
for free but we will answer as many of your questions as we can.
Top
2.) Subscribe Function
==============================================================
The subscribe function can be used in any of your ASP pages to subscribe
a person to your newsletter. This can be integrated into any contact
form, cart checkout or member registration system you wish. Open
the subscribe_function.asp page and look at this line-by-line. This
basic tutorial assumes you are fairly experienced with hand coding
VBScript and using Functions.
If you're looking at the subscribe_function.asp page now, view
the source code. On lines 1 & 2, we are using server side includes
to include the config.asp file (with the database connection), and
the inc_functions.asp file (which contains the code functions needed
in this tutorial). You will need these two files in any script you
wish to implement this with and can be found in the admin directory
of the mailinglist. Make sure you change the paths of the includes
to reflect your directory structure.
Lines 15-40 will render a basic table inside a form to collect
all of the data we need. When using the subscribe function, you
need to pass the following information:
- Subscriber Name [MLName] (optional)
- Subscriber Email Address [MLEmail] (required)
- Format - Text or HTML [MLFormat] (required)
- List ID [MLList] (required)
If we look at line 44, we see simple validation code that checks
to see if the form has been submitted. If yes, then execute the
following code, else, do nothing. Line 76 is the "End If"
code needed to end that check.
Now we need to look at the how to actually call the function. To
make it easier to understand for beginners, we set our four variables
before executing the function. This is done on lines 19-52. Now
that we have our variables set, we simply need to execute the subscribe
function which is done on line 54. You will need to use this code
to execute the function (which is called from the inc_functions.asp
file).
Subscribe
= subscribeNew (MLName, MLEmail, MLFormat, MLListID, MLSubscriberID)
Since this is a simple tutorial, we just want to display the results
of the function to the browser. The function will return a number
based upon the failure, or success of the subscription. We used
an "If then, Else If" statement to determine which
message to display:
- 1 = Invalid List ID (not numeric)
- 2 = Invalid email address
- 3 = Invalid Format (must be sent as "text" or "html")
- 4 = Invalid List (could not be found in the database)
- 5 = Email Address already subscribed to that List ID
- 6 = Subscription was successful, but no ID was found
- 7 = Subscription successful, the ID of the subscriber returned
as "MLSubscriberID"
That's it! You can apply this code in any fashion you need and there
is no need to validate the info before hand, all of that is done
inside of the function. The Subscribe Function automatically takes
the current time and inserts that, a URL Click Count of 0 and a
read count of 0. You can change the "If then, Else If"
statement to redirect to an error page, display an error message,
or you can ignore it entirely if you wish. The choice is up to you!
Top
3.) Un-Subscribe Function
==============================================================
The un-subscribe function can be used in any of your ASP pages to
remove a person from list. This can be integrated into any user
management system. Open the unsubscribe_function.asp page and look
at this line-by-line. This basic tutorial assumes you are fairly
experienced with hand coding VBScript and using Functions.
If you're looking at the unsubscribe_function.asp page now, view
the source code. On lines 1 & 2, we are using server side includes
to include the config.asp file (with the database connection), and
the inc_functions.asp file (which contains the code functions needed
in this tutorial. You will need these two files in any script you
wish to implement this with and can be found in the admin directory
of the mailinglist. Make sure you change the paths of the includes
to reflect your directory structure.
Lines 16-21 will display a basic form to collect the SubscriberID
of the person we wish to remove. When using the unsubscribe function,
you need to pass the following information:
Now we need to look at the how to actually call the function. To
make it easier to understand for beginners, we set our variable
before executing the function by placing the value received from
the form to a variable named MLSubscriberID on line 27. Now that
we have our SubscriberID set, we simply need to execute the unsubscribe
function on line 28. You will need to use this code to execute the
function (which is called from the inc_functions.asp file).
remove
= RemoveSubscriber (MLSubscriberID, strDBType)
The strDBType is the type of database you are using and should
be set in the inc_config.asp file. You do not need to set this yourself
as it will be picked up from that file. The function will return
a number based upon it's success or failure:
- 1 = Failed: Invalid/Missing Information
- 2 = Subscriber Successful Removed
To minimize the use of the database, there is no validation before
hand to see if a subscriber with that ID exists. That's it! You can
change the "If then, ElseIf" statement to redirect to
an error page, display an error message, or you can ignore it entirely
if you wish. The choice is up to you!
Top
4.) Get Subscriber Function (1)
==============================================================
The Get Subscriber function can be used in any of your ASP pages
to retrieve the details of a subscriber from the database by passing
the SubscriberID. This can be integrated into any user management
system. Open the get_subscriber_function.asp page and look at this
line-by-line. This basic tutorial assumes you are fairly experienced
with hand coding VBScript and using Functions.
If you're looking at the get_subscriber_function.asp page now,
view the source code. On lines 1 & 2, we are using server side
includes to include the config.asp file (with the database connection),
and the inc_functions.asp file (which contains the code functions
needed in this tutorial). You will need these two files in any script
you wish to implement this with and can be found in the admin directory
of the mailinglist. Make sure you change the paths of the includes
to reflect your directory structure.
For this demo, lines 17-21 simply write out a quick form that will
collect a Subscriber ID to pass to the function. When using the
Get Subscriber function, you need to pass the following information:
- MLSubscriberID (required)
Now we need to look at the how to actually call the function. To
make it easier to understand for beginners, we set our variable
before executing the function by placing the value received from
the form to a variable named MLSubscriberID on line 28. Now that
we have our SubscriberID set, we simply need to execute the Get
Subscriber function on line 29. You will need to use this code to
execute the function (which is called from the inc_functions.asp
file).
getData
= GetSubscriber(MLSubscriberID, MLListID, MLListName, MLName, MLEmail,
MLFormat, MLSubscribed, MLClicks, MLReads)
There is no need to set values for the other variables as they
will be populated if a subscriber is found. The function will return
a number based upon it's success or failure and the extra data for
the subscriber if successful:
- 1 = Failed: Invalid ID Number
- 2 = Subscriber Not Found
- 3 = Successful (see below for returned data)
- MLListID = The ID Number of the subscribed list
- MLListName = The text name of the subscribed list
- MLEmail = The subscribed email address
- MLName = The subscribed name
- MLFormat = Text or HTML, the subscribed format
- MLSubscribed = Date of subscription
- MLCLicks = The number of tracked clicks
- MLReads = The number of tracked reads
- MLSubscriberID = The ID of the subscriber
The "If Then, ElseIf" statements are there simply to
display the appropriate message. Use your own to determine which
action to take.
Top
5.) Get Subscriber Function (2)
==============================================================
The Get Subscriber Function (2) can be used in any of your ASP pages
to retreive the details of a subscriber from the database by passing
a ListID and Email Address. This can be integrated into any user
management system. Open the get_subscriber_function2.asp page and
look at this line-by-line. This basic tutorial assumes you are fairly
experienced with hand coding VBScript and using Functions.
If you're looking at the get_subscriber_function.asp page now,
view the source code. On lines 1 & 2, we are using server side
includes to include the config.asp file (with the database connection),
and the inc_functions.asp file (which contains the code functions
needed in this tutorial). You will need these two files in any script
you wish to implement this with and can be found in the admin directory
of the mailinglist. Make sure you change the paths of the includes
to reflect your directory structure.
For this demo, lines 17-27 simply write out a quick form that will
collect a ListID and email address to pass to the function. When
using the Get Subscriber Function (2), you need to pass the following
information:
- MLListID
(required)
- MLEmail (required)
Now we need to look at the how to actually call the function. To
make it easier to understand for beginners, we set our variables
before executing the function by placing the values received from
the form to a variable named MLListID & MLEmail on lines 34
& 35. Now that we have our information set, we simply need to
execute the Get Subscriber Function (2) on line 36. You will need
to use this code to execute the function (which is called from the
inc_functions.asp file).
getData
= GetSubscriber2(MLSubscriberID, MLListID, MLListName, MLName, MLEmail,
MLFormat, MLSubscribed, MLClicks, MLReads)
There is no need to set values for the other variables as they
will be populated if a subscriber is found. The function will return
a number based upon it's success or failure and the extra data for
the subscriber if successful:
- 1 = Failed: Invalid Data
- 2 = Subscriber Not Found
- 3 = Successful (see below for returned data)
- MLListID = The ID Number of the subscribed list
- MLListName = The text name of the subscribed list
- MLEmail = The subscribed email address
- MLName = The subscribed name
- MLFormat = Text or HTML, the subscribed format
- MLSubscribed = Date of subscription
- MLCLicks = The number of tracked clicks
- MLReads = The number of tracked reads
- MLSubscriberID = The ID of the subscriber
The "If Then, ElseIf" statements are there simply to
display the appropriate message. Use your own to determine which
action to take.
Top
6.) Newsletter Archives
==============================================================
The Spd E-Letter comes with a stock archive viewing script. To use
this script, there are a few variables you need to set. IF you open
the archive.asp script found in the mailinglist root folder, we'll
look at this line-by-line. The first 4 lines of code will look like
this:
<%
showList = 1 ' The ListID of the Archive to show
(must be a public list!)
showFormat = 3 ' 1 = text only, 2 = html only,
3 = both
%>
First you need to choose the ID Number of the list you want to
show the archives. You can get this from the administration section.
Go to "Lists" >> "View Lists" and the
ListID will be the number to the left of the List Name. Since you
may only send out one version of your newsletter, you can choose
which version you would like to make publicly available. A value
of 1 on showFormat will override the script and only allow the Text
version to be viewed. A value of 2 will override and show only the
HTML version while a value of 3 will let the visitor choose. In
the event that no format is chosen, it will automatically default
to Text only.
You can change the entire page to look exactly like you want it
to and/or add in your site template. Wherever you would like the
content returned, simply leave in the server side include. This
include will return the results and let the visitor choose the correct
Newsletter. Make sure that the path is correct for your server structure.
When you have finished editing the file to look like you want,
it is suggested that you choose "Save As" and name it
something more meaningful. Feel free to edit the inc_archive_action.asp
file to display the data you wish or be in the format you want.
Top