This is a brief tutorial on showing "Featured Listings" on any site or page using the built-in RSS of 68C and an RSS parsing script. Keep in mind that the following tutorial shows an example of how I needed featured listings to display on one of our sites. If you try this, you will most likely want to customize it to suit your specific needs. What's Needed: • Developer Version of 68C • RSS Parsing Script (my tutorial uses caRP) • A decent knowledge of CSS for further customizing of the html Step 1. Modify RSS Output in external.php Approximately Line 113 (Custom Output for No Price) Find: Code: $price = ''; Change to: Code: $price = 'Price NA'; Approximately Line: 138 (Removes "Price in Title") Find: Code: echo "\t\t\t" . '<title><![CDATA['.html_entity_decode($listing['title'], ENT_QUOTES, 'UTF-8').$seperator.$price.']]></title>' . "\r\n"; Change to: Code: echo "\t\t\t" . '<title><![CDATA['.html_entity_decode($listing['title'], ENT_QUOTES, 'UTF-8').']]></title>' . "\r\n"; Approximately Line: 153 (Formats html output of feed with separate <div> for image and and price) Find: Code: $imDescription = "<a href=" . $listing['link'] . "><img src='" . URL . "/thumbs/small_" . $irs['image'] . "' align='left' style='margin: 0 5px 5px 0;' border='0' /></a>" . $listing['description'] . '<br clear="all" />'; Change to: Code: $imDescription = "<div class='rssimage'><a href='" . $listing['link'] . "'><img src='" . URL . "/thumbs/small_" . $irs['image'] . "' /></a></div><div class='rssprice'>$price</div>"; Approximately Line: 157 (Formats html output of feed with separate <div> for no photo and price) Find: Code: $imDescription = "<a href=" . $listing['link'] . "><img src='" . URL . "/images/nophoto.gif' align='left' style='margin: 0 5px 5px 0;' border='0' /></a>" . $listing['description'] . '<br clear="all" />'; Change to: Code: $imDescription = "<div class='rssimage'><a href='" . $listing['link'] . "'><img src='" . URL . "/images/nophoto.gif' /></a></div><div class='rssprice'>$price</div>"; Step 2. Convert the RSS feed to html Using an rss parsing script called caRP (others may work as well), we can now turn the RSS feed into html and display it anywhere you like. The following code is an example of what is placed on the page where you would like the listings to be displayed. Code: <div id="latestlistings"> <?php require_once '/path-to/carp.php'; CarpConf('encodingout', 'UTF-8'); CarpConf('cborder', ''); CarpConf('iorder', 'link,desc'); CarpConfAdd('descriptiontags', '|img|a|/a|div|/div'); CarpConf('bilink', '<div class="rsswrapper"><div class="rsstitle">'); CarpConf('ailink', '</div>'); CarpConf('bidesc',''); CarpConf('aidesc',''); CarpConf('ai', '</div>'); CarpCacheShow('http://www.my-classifieds-site/external.php?type=featured'); ?> </div> Step 3. Time to style the Output Below is an example of how I needed the feed to display. This can be changed to whatever your specific needs are. Code: #latestlistings { overflow: hidden; padding-top: 5px; width: 600px; } .rsswrapper { float: left; background-color: #333; border-radius: 4px; overflow: hidden; margin: 0 5px 10px 5px; padding: 10px; width: 270px; } .rssimage { background-color: #000; border: 1px solid #fff; float: left; height: 90px; width: 120px; } .rssprice { background-color: #f0f0f0; border-radius: 6px; color: #333; float: right; font: bold 12px Verdana, Geneva, Tahoma, sans-serif; padding: 5px 0; text-align: center; width: 100px; } .rsstitle { float: right; font: normal 11px Verdana, Arial, Helvetica, sans-serif; height: 60px; margin: 0; width: 130px; } .rsstitle a { color: #f60; text-decoration: none; } .rsstitle a:hover { text-decoration: underline; } ********************************************* What does the final output look like, in this example, it would appear something like this: This is a very basic example of what can be done with 68C and caRP working together. The possibilites are vast as the RSS feature of 68C can output many variables such as owner specific listings, category specific listings etc. caRP is also very feature rich as you can do things like displaying listings in random order, changing the sort order with complete control over the styling of the feed. I'm thinking about using this technique to display "similar items" on my viewlisting.tpl on one of my sites. Another thing to keep in mind is that the listings are not inline framed into your page, so you do get some SEO benefit as well.
This is a nice tutorial and shows what can be done with a little creativity. A couple of things that I would suggest, however is instead of making direct modifications to the core php file, external.php, I would ALWAYS recommended making a copy of the file instead and then saving it to a different name such as external2.php. Otherwise, whenever you choose to upgrade your 68 Classifieds script this file does not get overwritten and/or you do not have to make your modifications over again. You can include external rss feeds into your 68 Classifieds site with the built in rss parser, magpie which is already installed with 68 Classifieds. I have made custom smarty plugins to do exactly this to get external rss feeds for related content for the site. As far as including things like "related items" or whatever from within your classifieds, doing an rss feed seems like over complication when you could simply just make a smarty plugin to get whatever you want including exactly how to output your content. That way you're not getting listings converting them to XML, then parsing XML back into html, etc.. Even without doing anything special, you could simply use the listings plugin that is already included within a listing to show other ads, just like on the home page or duplicate the plugin to make whatever modifications you would like to.
Totally agree with everything you said Mike...thanks. For myself, I'm pulling the majority of the data to place on pages and websites outside of the classifieds site itself. Not being a programmer myself, I find that this is a fairly easy way to accomplish this.