ASPRSS - Enabling you to share your ASP resources
ASPRSS --> Becoming a directory: Creating your form

If you haven't yet read the overview, you should do so now.

This page describes in detail the steps you need to follow before you can accept RSS article submissions.

Create a submission form for RSS submissions

What exactly will be submitted?

RSS data is XML, but you don't have to deal with that. The source code that we supply will convert the RSS into individual resources and pass them to you one at a time. All you have to do is process the data just as you would from a regular submission form.

However, if you're not an experienced web developer fluent in HTML and a server-side environment like Active Server Pages we should point out that you will need to do some server-side programming to process the data submitted to your form.

How do I create the form?

We provide all the source code you need to support your RSS submission form, but you will need to modify it to work with your site. We show you how. All the code is contained in this zip file. Download that first.

The source code you will use comprises just two files: RSSform_xx and RSSdir_xx, although the zip file contains versions for all of the supported languages and platforms. The xx will depend on the language of your choice:

• vbs.asp - Active Server Pages written in VBScript
• js.asp - Active Server Pages written in JavaScript

The languages below are not currently supported, but will be soon. Can you help?

• cs.aspx - Active Server Pages.NET written in C# (c-sharp)
• vb.aspx - Active Server Pages.NET written in VB
• js.aspx - Active Server Pages.NET written in JScript.NET

What changes do I need to make?

Obviously, depending on which language you choose the sample code will be different, so we won't step you through line-by-line. However, every version has certain things in common which we document here.

Firstly, every version consists of two files - only one of which, RSSform, you have to modify to suit your site. The other file, RSSdir, contains the code that does the hard work for you. The intention is that any updates that we make to this file will only require you to copy the new file to your server.

To use the sample code you must have the MSXML3 component installed on your server. All the sample code was tested with the SP1 update, which can be installed from Microsoft's web site.

It is important that some parts of your form remain "standard". You can change the look and feel of the page, but you cannot edit or delete the form inputs provided. They will be used for automatic submissions from ASPRSS. We'll point out exactly what must not change as we walk through the code.

nResources = 0
nDuplicates = 0
sSubmitRSS = "Process remote RSS"

The sample code in RSSform starts by initializing some variables. nResources and nDuplicates are used to count the number of submitted resources and those that were discarded because they already exist in your database. They are completely optional, and were just added to give some feedback to the user - you can remove them if desired. sSubmitRSS contains the text shown on the submit button when submitting a URL - again, you can change it to be whatever you wish.

' which submit button was pressed?
sSubmit = "" & Request.Form ( "action" )

If sSubmit = sSubmitRSS Or sSubmit = "ASPRSSAutoSubmit" Then

When the form is submitted we test which submit button was pressed by looking at the value of the "action" form item. This is one reason why the submit button text was put into the sSubmitRSS variable. You'll notice that we also test for "ASPRSSAutoSubmit" - this is to allow ASPRSS to automatically submit to your form, so do not remove that!

' get the URL                                                 ' get the XML data
sURL = "" & Request.Form ( "URL" )                 sXML = "" & Request.Form ( "XML" )

' process the file                                            ' process the data
bSubmitted = ProcessRSSurl ( sURL )              bSubmitted = ProcessRSSdata ( sXML )

Depending on the submit button pressed, one of two functions in the RSSdir SSI (Server Side Include) will be called: ProcessRSSurl or ProcessRSSdata. If for some reason you wish to change the names of the relevant form inputs to something other than "URL" and "XML" you can do so.

Both functions return False if the parsing of the RSS source failed, so I set the bSubmitted variable to this value causing the form to display.

As soon as the functions are called the data is processed. The results of the processing are passed back to you by calling some functions which we will get to in a moment. For now we'll continue walking through RSSform code sequentially...

' now show form if necessary
If Not bSubmitted Then
%>
   <p>
   <a href="http://ASPRSS.com/Refer.asp?Directory=123">
   <img src="http://ASPRSS.com/images/ASPRSS_46860.gif" width="468" height="60" border="0" alt="Submit here with RSS">
   </a>

As we've seen, bSubmitted will only be set when the page has been submitted successfully. If the form has not been submitted yet, or something went wrong with the submission the form will be displayed.

The look and feel of the entire page can be changed as necessary. The sample code shows an ASPRSS banner with a link back to a page on ASPRSS, but you can remove all this.

We do recommend that you provide a link page to "http://ASPRSS.com/Refer.asp?Directory=123" somewhere on the page though - this page is customized to publicize your site alone. Remember to replace the 123 with your sites ID, which was given to you when you registered. For alternative images to use for the link, see the support ASPRSS page.

Function ProcessError ( sError )
%>
   <p><font color="red"><%=sError %></font>
<%
End Function

As mentioned earlier, the results from processing the RSS data are passed back to you by calling some pre-defined functions in this RSSform page. The first, ProcessError, is shown above. This function is called when an error occurs in the data, usually because the MSXML3 component fails to parse it. The provided code simply displays the error message, but in common with all these functions you can do whatever you wish.

Function ProcessNewRSS ( sRSSURL )
%>
   <h3>Processing RSS file at <%=sRSSURL %>:</h3>
<%
End Function

ProcessNewRSS is called once per RSS source. It may seem that this should only be called once, but there is a circumstance when this isn't true - RSS data can include a link to other RSS sources (and the RSSdir code will follow those links).

As an example, ASP Alliance may have an RSS file that contains links to all the alliance members' RSS data. Submitting that RSS to this form will automatically submit all the resources from all members' sites.

Function ProcessPublisher ( sSiteTitle, sSiteDescr, sSiteURL, sSiteDetails, sImageURL )
   ' process publisher information
End Function

ProcessPublisher is called whenever a new publisher is found in the RSS source - usually only once per RSS source. So if ProcessNewRSS gets called, ProcessPublisher is not far behind. We're guessing that you'll probably want to store this data in variables for use later when processing individual resources.

Descriptions of the parameters you are sent are shown below:

ParameterDescription
sSiteTitleThe name of the website.
sSiteDescrA description of the website
sSiteURLThe URL of the website with a trailing / character, e.g. "http://www.abc.com/".
sSiteDetailsFurther details such as address, telephone, fax - more than likely for your internal use only.
sImageURLThe URL of a 100x30 gif image, e.g. "http://www.abc.com/images/mylogo.gif". You could show this image next to the resources.

function ProcessResource ( sTitle, sDescr, sURL, sDate, sCategory, sKeywords, nAuthors, sAuthorEmails, sAuthorNames )
   ' keep count of number submitted
   nResources = nResources + 1

   ' keep count of any already in database
   ' nDuplicates = nDuplicates + 1
End Function

The last function, ProcessResource is called for each resource present in the RSS. It is likely that this function is where you will gather the publisher data and the resource data together and process it just as you would your normal submission form.

Descriptions of the parameters you are sent are shown below:

ParameterDescription
sTitleThe title of the resource
sDescrA description of the resource.
sURLThe URL of the resource, e.g. "http://www.abc.com/MyFirstArticle.asp".
sDateThe date the resource was last modified, in the format YYYY-MM-DD.
sCategoryOne of the following options, as a hint to you: "Articles", "News", "Products", "Services", "Websites"
sKeywordsA list of comma-delimited suggested keywords that you can use.
nAuthorsThe number of authors in the arrays below...
sAuthorNames
sAuthorEmails
The author(s) for this resource. Both name and email are optional, but one must be present(!)

Congratulations - if you've followed these instructions you can now accept RSS submissions! Be sure to become a member (it's free) so that we can show you in our database of RSS supporters, and link to your form. You'll appear on the Directories page, and will start getting automatic submissions from ASPRSS subscribers.

If you wondering about the last function in RSSform, DisplayElement, that is just included for demonstration and testing purposes while you are working on the form. You can remove this when it is no longer needed.


Contact us  -  Tell your colleagues  -  Show your support  -  Your privacy

Copyright © 2001-2009 James Shaw. All rights reserved.
A Clever Chaps Production