1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Rss feeds unleashed

Discussion in 'Tips & Tricks' started by Mike-N-Tosh, Feb 7, 2014.

  1. Mike-N-Tosh Owner

    68 Classifieds supports RSS feeds using the external.php file. You can easily link to it by using
    http://yoursiteurl/external.php at other sites or in email. This will create a link that when clicked, will trigger the users default RSS Feed reader which could be a dedicated application, a web browser or even their email application. This link would be a feed of all of the listings on your site limited only by the preferences setup in the end users client application.

    You can add the link on your site within a template folder using a standard html "anchor" link with the "Smarty" url like this:
    HTML:
    <a href="{$smarty.const.URL}/external.php">RSS Feed</a>
    The thing that most people don't realize is that this file can take parameters just like the smarty plugins do. This means that you can tell the feed to only select certain listings for the feed. You can use; type, limit, category, showchild, city, state, country, owner and both minimum & maximum price too!

    Let's make a link on your site using a parameter. This link will be for Featured Listings which is a "type" of listing.
    HTML:
    <a href="{$smarty.const.URL}/external.php?type=featured">Featured Listings Feed</a>
    To use a parameter, you use the url for the standard feed "{$smarty.const.URL}/external.php", but now you add a "?" which tells php that you are going to give it some parameters. In this case the parameter is for type. The type is featured, thus the parameter is type=featured.

    Using this same logic, let's try a practical and useful example. You know how your users can click on "Browse" and then it takes them to the categories page? Then they select category, etc. You could create an RSS Feed in the browse.tpl file that would show a feed link for the currently browsed category using the category parameter and a smarty variable like this:
    HTML:
    <a href="{$smarty.const.URL}/external.php?category={$categoryid}">{$categoryname}</a>
    Another practical example might be in the viewlisting(2).tpl file. You could show an RSS Feed link for the sellers listings.
    HTML:
    <a href="{$smarty.const.URL}/external.php?owner={$owner}">{$username} RSS Feed</a>
    Now what if you want to use more than one parameter? Well, that's just as easy, you can just add an "&" (ampersand) and another parameter. So let's say you wanted a feed for featured listings just in one category.
    HTML:
    <a href="{$smarty.const.URL}/external.php?type=featured&category=XX">Featured Listings Feed for Horses</a> <!-- Where "XX" is the category id for the category horses. -->
    This should be enough to get your creative juices flowing.

    The last thing you need to know is what each parameter will take:
    type (new, featured, top)
    limit (number)
    category (categoryID number)
    showchild (Y or N)
    city (text)
    state (text)
    country (text)
    owner (userID number)
    searchtext (text – [You need to use %20 instead of a space between words, like%20this])
    minprice (integer without any currency signs)
    maxprice (integer without any currency signs)
  2. freeze2 Super Moderator

    Great info Mike...thanks!

Share This Page