WSN Forum
Featuresspacer Showcasespacer Reviewsspacer Demosspacer Purchasespacer Manualspacer Support
JavaScript Export
JavaScript Export
By Paul

Suppose you want to allow a plain HTML page to display top topics from your site. You may either want to do this on one of your own pages, or to distribute the ability to your site's visitors so that they can place your list of top links on their own site. With the help of some JavaScript, this is possible. Users can configure the type of toplist they wish to display. Thanks to din for developing this feature.

Customize the basics of the look by editing your 'JavaScript Export' template (in the misc templates section of your template editor). Note that if you're doing a toplist of something other than topics you must edit the default template to something that includes the temlpate variables of the type you're trying to display.

The 'javascript export' page of your admin panel allows you to set timed (every 12 hours) generation of the data, which is strongly advised to speed page loading. Use the toplist generator and copy the <CONFIG> line from it to the javascript export page.

Place
<script language="javascript" src="http://yoursite.com/wsnlocation/javascript/yourname.js"> </script> in the page where you want the generated yourname.js content shown. Change yoursite.com/wsnlocation to where you've installed WSN, and yourname.js to the name you chose on the javascript generation page.

For Advanced Users

If you really want instant data with total flexibility, you can use this basic JavaScript:
<script language="javascript" src="http://yoursite.com/wsnlocation/exporter.php"></script>

Change yoursite.com/wsnlocation to where you've installed WSN. You can add parameters onto the end by adding ?name=value. Set the default by editing the template. The available parameters are the same as for any toplist:
type[1]
number[1]
field[1]
order[1]
ascdesc[1]
thecondition[1]

Example: For a JavaScript to show a toplist of the 10 newest comments, use <script language="javascript" src="http://yoursite.com/wsnforum/exporter.php?number[1]=10&field[1]=time&ascdesc[1]=descending&type[1]=comments"></script>

To do only regular type comments, you'd use <script language="javascript" src="http://yoursite.com/wsnforum/exporter.php?number[1]=10&field[1]=time&ascdesc[1]=descending&type[1]=comments&thecondition=type='regular'"></script>
You can use a different template by adding &template=javascript_export2 to the URL, where javascript_export2.tpl is the template file in the /custom/ subdirectory of your templates directory. If &template= is not specified, the javascript_export.tpl template is used.

If you're using this to let other people put your content on their site, you can either instruct them in how to customize it or write up specialized versions for them.

Please note that this exporter.php call method is dynamic, and thus slow. The page has to be rendered before being sent as javascript. To avoid slowing down the pages of people using your javascript, go to the 'JavaScript export' section of your admin panel.

Rating:


3.43/5 based on 7 votes. The median rating is 4.

Submitted: 10/18/03 (Edited 02/18/09)

Description: Using WSN information on static pages and other websites.

Views: 2526 views. Averaging 1 views per day.
In the most recent 30 day period, there've been 0 views.

Previous Article | Next Article

Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support