Advertisement
bondcemil

rss

Dec 26th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <?php require_once("_inc.php");
  2. $site_url = $config->site->url;
  3. $site_title = $config->site->name;
  4.  
  5. echo '<?xml version="1.0" encoding="UTF-8" ?>
  6. <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  7.                 <channel>
  8.                 <atom:link href="'.$site_url.'feed/" rel="self" type="application/rss+xml" />
  9.  
  10.                     <title>'.$site_title .'</title>
  11.                     <link>'.$site_url.'</link>
  12.                     <description>'.$site_title.'</description>
  13.                     <language>en</language>';
  14.  
  15. $string = '';
  16. $sql = dbquery("SELECT id,title,description FROM videos WHERE views > 1 ORDER BY id DESC LIMIT 0,24 ");
  17.    
  18.                      while($row = mysql_fetch_array($sql)){
  19.     $new_id = $row["id"];      
  20.     $new_title = $row["title"];  
  21.     $new_description = $row["description"];  
  22.     $new_seo_url = $site_url.'video/'.$new_id.'/'.seo_clean_url($new_title) .'/';  
  23.   $string .='<item>
  24.                 <title>'. htmlspecialchars($new_title) .'</title>
  25.                 <link>'.$new_seo_url.'</link>  
  26.                 <guid>'.$new_seo_url.'</guid>
  27.                 <description><![CDATA[Watch '. htmlspecialchars($new_description) .']]></description>
  28.                 </item>';
  29.                 }
  30.         $string .='</channel>
  31.         </rss>';       
  32.  
  33. echo $string;
  34.    
  35. MK_MySQL::disconnect();
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement