Advertisement:

Author Topic: ADS rss  (Read 3053 times)

irishrage

  • Full Member
  • ***
  • Posts: 132
ADS rss
« on: June 27, 2011, 04:31:16 pm »
It would be nice to be able to use rss code to show latest ads/feature on external sites to advertise your os class webbsite. What do you guys think about this? ;D

kingsult

  • Premium
  • Full Member
  • *****
  • Posts: 204
Re: ADS rss
« Reply #1 on: June 27, 2011, 06:07:31 pm »
hmmm... if you used the main rss feed and submit it on different sites, it works. I did it on my blog: http://www.sxm-market.com/blog

Is this what you mean ?

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: ADS rss
« Reply #2 on: June 27, 2011, 07:16:25 pm »
I've started a plugin in Wordpress to import the latest items to posts or pages. Work is in progress, I let you know when it's finished :) At least, a beta version.

irishrage

  • Full Member
  • ***
  • Posts: 132
Re: ADS rss
« Reply #3 on: June 29, 2011, 12:15:50 am »
Yeah but with images included ;D

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: ADS rss
« Reply #4 on: June 29, 2011, 02:05:36 pm »
I see. We're going to add this in 2.2 version.

Dannymh

  • Jr. Member
  • **
  • Posts: 58
Re: ADS rss
« Reply #5 on: July 01, 2011, 10:54:29 am »
I have created my own RSS that I use to publish ads on Facebook via RSS Grafiti.

The reason I use my own is that I wanted to have the images included in the RSS and therefore pushed to Facebook.

This is just standard PHP code and does not use the Os Class stuff but I you can put it into your system, add your dataase connection details and it should work for you too

If someone wants to change this to os Class code go ahead, it could be a good plugin or the core RSS could be updated to have the image included. One thing to note is that the query used is not optimized for large databases, and could use some re-writing even adding a limit clause would help, but hope it helps some

You will need to edit the database, username, password and host as well as changing the image URL to your own

You can see this at http://herveybaybuysell.com/rss.php and on the facebook page http://www.facebook.com/pages/herveybaybuysellcom/101483139942926 to see the results once it is pushed through

Code: [Select]
<?php


$rssfeed 
'<?xml version="1.0" encoding="UTF-8"?>

';
$rssfeed .= ' <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
';
$rssfeed .= ' <channel>
';
$rssfeed .= ' <title>herveybaybuysell.com latest items</title>
';
$rssfeed .= ' <link>http://www.herveybaybuysell.com</link>
';
$rssfeed .= ' <description>This feed shows the latest items posted on herveybaybuysell.com</description>
';
$rssfeed .= ' <language>en-us</language>
';
$rssfeed .= ' <copyright>Copyright (C) 2011 herveybaybuysell.com</copyright>
';

$connection = @mysql_connect('<host>', '<databaseUser>', '<password>')
or die('Could not connect to database');
mysql_select_db('<database>')
or die ('Could not select database');

$query = "SELECT DISTINCT i.pk_i_id AS id, i.dt_pub_date AS pubdate, i.f_price AS price, i.s_contact_name AS contact_name, id.s_title AS title, id.s_description AS description, il.s_city_area AS location, ir.s_path AS impath, ir.pk_i_id AS imname, ir.s_extension AS sextension, ir.s_content_type AS icont_type
FROM oc_t_item i
JOIN oc_t_item_description id ON i.pk_i_id = id.fk_i_item_id
LEFT JOIN oc_t_item_location il ON i.pk_i_id = il.fk_i_item_id
LEFT JOIN oc_t_item_resource ir ON i.pk_i_id = ir.fk_i_item_id
WHERE i.b_active = 1
GROUP BY i.pk_i_id
ORDER BY i.dt_pub_date DESC";
$result = mysql_query($query) or die ("Could not execute query");

while($row = mysql_fetch_array($result)) {
extract($row);

$link = "http://herveybaybuysell.com/".$title."_".$id;
if($imname){
$item_image = 'http://herveybaybuysell.com/'.$impath.$imname.'_thumbnail.'.$sextension;
}
else
{
$item_image = 'http://herveybaybuysell.com/oc-content/themes/hbs/images/no_photo.gif';
$icont_type = 'image/gif';
}

$rssfeed .= ' <item>
';
$rssfeed .= ' <title>' . $title . '</title>
';
$rssfeed .= ' <description>' . $description . '</description>
';
$rssfeed .= ' <enclosure url="'.$item_image.'" type="'.$icont_type.'" />
';
$rssfeed .= ' <link>' . $link . '</link>
';
$rssfeed .= ' <pubDate>' . date("D, d M Y H:i:s O", strtotime($pubdate)) . '</pubDate>
';
$rssfeed .= ' </item>
';
}

$rssfeed .= '</channel>
';
$rssfeed .= '</rss>
';

echo $rssfeed;

« Last Edit: July 01, 2011, 10:58:25 am by Dannymh »