Maximum Traffic Page Generator Nerd Lib Software Labs
Nerd Lib Software Labs - Home of Maximum Traffic Our Product Line Get Maximum Traffic Today Maximum Traffic Frequently Asked Questions Maximum Traffic Support Center
Nerd Lib News
 
02/08/2006
AdSense Guide
More Details
 
01/15/2006
50% off Sale
More Details
 
12/29/2005
Free Alexa Tips
Read Article
 
12/11/2005
MT: Xmas Update
See Patch Notes
 
12/08/2005
Traffic Scams
More Info
 

Read All Testimonials

Please include a website URL when you send us your testimonials!

Send a Testimonial



 - Sample Sites
 - Download V2
 - Send a Comment
 - Training Video
 - ArticleCity HowTo
 - RSS/XML Example
 - Scripting Intro

Nerd Lib Resources
Learn about Nerd Lib Software
Contact the Nerd Lib Support staff


To get the latest news on our software, please input the following;

E-mail address:


Full name:





 

affiliate programs



Free Web Hosting

Would you like to advertise here?

 


Introduction to scripting parser scripts with Maximum Traffic

Version 2.0 has many new features, including the ability to configure your own content sources and the parsing scripts they use.

The following example will demonstrate how you too can use RSS feeds during the generate cycle.

A little bit of patience may be required getting your scripts just right, but becoming a powerful script writer is something every webmaster can benefit from.

Adding an RSS Feed

Step 1: Download Script
Save NewsIsFree.js.txt as NewsIsFree.js (without the .txt extension), in your 'scripts/content' folder. This folder is in the Maximum Traffic installation folder.

An easy way to get to it is to open the program, and click on one of the two Open buttons beneath autoupdate.

From there navigate up one folder to the base program folder, and then navigate to the 'scripts' folder.

We are working with Content scripts, so inside the scripts folder navigate to the 'scripts/content' folder.

Step 2: Setup Content Source
Once you have the file 'scripts/content/NewsIsFree.js', go to the Content Sources screen in the program, and click New at the bottom left.

You will need to input the following:


Method:		GET

Timeout: 30
Feed URL: http://xml.newsisfree.com/popular.xml
Referer URL: http://www.newsisfree.com/sources/popular/
Parse Script: NewsIsFree.js
Please note that you do not need any request variables, nor do you need the checkbox for 'Fetch Referrer URL' checked. The settings above are all that is necessary for this source.

Step 3: Save and Test
Save the content source as NewsIsFree and then click on the Test button found above the Save button.

Enter anything as a keyword as it's not used in this example anyways. Click OK or press Enter.

If all is well, you should see some content!

Extra Information: Script Breakdown
Here is the script broken down so you can better understand how it works:

  • import System.Data;
    import System.Windows.Forms;
    
    These lines are needed for the MessageBox function and for use of Data objects. You'll need at least System.Data as it contains the entry for the type of DataSet.
     


  • public static function SetupDataSet() ..
    public static function AddRow(sBody,sDate, ..
    
    Two functions that come in handy when creating any script, to easily construct the DataSet for use in the program.
     


  • public static function XMLtoDataSet(sData) {
      var xml = new ActiveXObject("MSXML2.DOM ..
    
      xml.validateOnParse = false;
      xml.async = false;
      xml.loadXML(sData);
    
      ..
    
    This function does what the name implies, it handles the process of turning the data returned from the URL into a DataSet full of content for the program to use.

    This is the basic few lines you need to 'load' some XML data into a javascript object.
     


  • var d = new Date();
    var gd = d.getFullYear()+"-"+d.get ..
    
    In this particular feed, there is no <date> in the entries, so we make our own.
     


  • if (xml.parseError.errorCode != 0)
      System.Windows.Forms.MessageBox.Show("XML ..
    else
    {
      ..
    
    A message box is displayed if the XML parser had a problem parsing the data.
     


  • var oNodeList = xml.getElementsByTagName("item");
    ..
    for (var i = 0; i < oNodeList.length; i++) {
      ..
    }
    
    The XML nodelist for the <item> node is set to a javascript variable, and then the script loops through all of the children nodes.
     


  • for (var i = 0; i < oNodeList.length; i++) {
      var sBody = oN .. .. de("title").text;
      var sTitle = o .. .. ode("description").text;
      var sURL = oNo .. .. e("link").text;
    
    This takes the XML items such as <title>, <description> and <link> from the XML feed and places them into javascript variables for further use by the script.
     


  • var re = />([\w\d\s\S]+)</i; // match words, ..
    var p = null;
    
    if ((p = re.exec(sTitle)) != null) {
      AddRow(sBody, gd, p[1], sURL);  // p[1] is th..
    } else {
      // uncomment the next line to see any ugly on..
      // AddRow(sBody, gd, sTitle, sURL);
    }
    
    This uses a regular expression (a.k.a. regex, regexp) to just pull a peice out of what the XML feed gives us for <title> entries.

    You don't need to get this fancy, but it is an example of how you could should you require to.

    The 2nd commented line in this part of the code is how you would input the <title> entries unchanged.
     


  • public class Parser {
      public static var ds : DataSet = new DataSet();
    
      ..
    
      public static function Parse(sInput) : DataSet {
        SetupDataSet();         // Required, this .. 
        XMLtoDataSet(sInput);   // Function fills .. 
        return(ds);             // Required.
      }
    }
    
    This class and initialization function are required in every script, this is the starting point of a script.

    The Parse function must return a valid DataSet object to the program if the javascript output is intended to be used through the template system.
     




That's it for the way this script works. We hope you find this helpful in aiding you in developing your own scripts!

JScript .NET Manual: JScript .NET Language Reference (JScript)

JScript .NET on Google: Click to Visit



Maximum Traffic Version 2.0

Download Now | Buy Now



Maximum Traffic
Version 2.0



FREE TRIAL
DOWNLOAD

(15-Day Time Limited)

Minimum Requirements
Installation Video
Release Notes

 

 

 

Credit Card Processor
 


Thank you for making Maximum Traffic the #1 Traffic Generation program on the net!

Click here for more great products.




02/08/2006
AdSense Guide

01/15/2006
50% off Sale

12/29/2005
Free Alexa Tips

12/11/2005
MT: Xmas Update

12/08/2005
Traffic Scams

11/07/2005
Sample Sites

11/04/2005
10 Google Tips

10/27/2005
KeywordFinderz

10/26/2005
Script Update

10/23/2005
Major Update

10/05/2005
Content Sources

10/03/2005
MT Installation Guide

09/28/2005
MT Image Converter

09/27/2005
Advertising Options

09/22/2005
MT Image Cropper

09/18/2005
Content Sources

09/15/2005
MT Thumb. Generator

09/13/2005
MT Template Wizard

09/12/2005
Meta Helper v1.0

09/01/2005
Our Letter


View All Articles


Increase your traffic with Maximum Traffic