Latest Register Log In

+ Advanced Search

XML Feed Submissions

XML Feed Submissions
By
08/21/07 (Edited 11/08/15)

This article is about submitting another site's feed to supply WSN listings. If you're looking to generate a feed from WSN content see RSS Feeds and if you just want to display a feed's content in a template see Template RSS Parser.

In your switches, you have an "XML feed submissions" option. Switching this on enables a system where visitors can submit feeds of listings which are automatically processed and updated, instead of submitting the listings individually. In your usergroup permissions you can set who can submit and whether validation is required.

Please note that this article is about submitting a feed such that all items in it will become listings in your links directory. If a feed should be associated with a particular listing, see Associating an RSS Feed With a Listing instead.

The option to submit a feed appears next to that for submitting listings, as long as your usergroup has permission. The simple case is to submit a standard RSS feed, but you can specify any additional custom fields you like in the feed if you desire. Once you've submitted, you can manage your personal feeds in your member home.

When a feed is queried, any links found in it for which the same url hasn't already been added from the same feed will be added to the directory, in the category which the feed was submitted to. For WSN KB, Gallery and Forum, the title is checked instead of url.

The feed cache timeout setting (Admin -> Listings -> Listing Settings) will determine how often these feeds are checked, same as with feeds associated to listings.

Content For Article Directories and Forums

Feeds can be a quick and easy way to syndicate articles to your article directory or forum. WSN Knowledge Base will look for the content:encoded RSS field to use as the article text, and will fall back to using the description field as the article text if there isn't a content:encoded. WSN Forum will check those same fields to use as the opening post text for the topic. You may notice that a lot of feeds only contain a brief summary and do not include the full article -- you can use a site like http://fulltextrssfeed.com/ to convert those partial feeds into feeds that contain the complete article text, but you should make sure you have permission to reprint the full content if pulling someone else's feed.

Non-RSS XML Formats

Sometimes the RSS format is too limiting. Using the tweaks.php file, you can specify an alternate XML format like this:

$xmlrecordslabel = 'ad';
$xmlfields['startdate'] = 'effectivetime';
$xmlfields['stopdate'] = 'expire';
$xmlfields['zipcode'] = 'zip';
$xmlfields['class-title'] = 'title';
$xmlfields['content'] = 'description';


Set up the $xmlfields array so that the array index is what the XML calls the field, and the value is what WSN calls the field. The $xmlrecordslabel is what the XML calls the record, as compared with RSS calling it link.

Dealing With Images

When submitting a feed of images, presumably from a site like flickr for use in WSN Gallery, the images have to be imported in a delayed fashion (one per page load) to prevent memory errors and script timeouts. Warning: If you use GD, the memory GD uses to load and resize the images counts as part of the script's memory useage and will likely cause you to exceed php.ini's allowable memory limit -- causing the script to die to a blank page. If you can't increase the allowed memory, or would just prefer not to have to, use ImageMagick.

While the images are in the process of being retrieved, generating.png will be shown.

Template Variables

{XMLFEED template variables are available to show information about the feed. These varaibles are available in the scope of any listing that was added from a feed. Test for that scope with {LINKXMLSOURCE} like this:
<IF {LINKXMLSOURCE}>Source website: <a href="{XMLFEEDHOMEPAGE}">{XMLFEEDTITLE}</a></IF>


{XMLFEEDID} - The id number of the feed.
{XMLFEEDTITLE} - The title of the feed.
{XMLFEEDHOMEPAGE} - The URL of the website the feed is from.
{XMLFEEDURL} - The URL of the feed itself.
{XMLFEEDDESCRIPTION} - The description the feed supplies of itself.
{XMLFEEDDATE} - The feed's submission date.
{XMLFEEDTYPE} - The listing type for listings in the feed.
{XMLFEEDLASTFETCHEDDATE} - The date on which WSN last fetched an update of the feed.





Description Submitting, accepting and displaying RSS or XML Feeds.
Rating
Views 3782 views. Averaging 1 view per day.
Similar Listings