Location: PHPKode > projects > BlogNEasy > rss.php
<?php
/*---------------------------------------------------+
| BlogNEasy
| Copyright 2012 Fernando Baptista
+----------------------------------------------------+
| RSS feed creator rss.php
| Version 0.9
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/

// $pathtonews must point to the page that displays your news, relative to server www root
// replace the page name if needed, default is "news" on the root www directory
error_reporting(E_ERROR | E_WARNING | E_PARSE);

require "data/config.php";
$set['title']=strip_tags(utf8_decode(stripslashes($set['title'])));
$set['subtitle']=strip_tags(utf8_decode(stripslashes($set['subtitle'])));
header('Content-type: application/rss+xml; charset=utf-8');
$out.="<?xml version=\"1.0\" ?>\n";
$out.="<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/RSS\">\n";
$out.="<channel>\n";
$path=sv(SERVER_NAME).sv(PHP_SELF);
$path1=str_replace("rss.php","index.php",$path);
$out.="<atom:link href=\"http://".$path."\" rel=\"self\" type=\"application/rss+xml\" />\n";
$out.="<title>".$set['title']."</title>\n";
$out.="<description>".$set['description']."</description>\n";
$out.="<link>http://".$path."</link>\n";
$path1=str_replace("rss.php","index.php",$path);
$aa=explode("||",trim(file_get_contents("data/posts.dat")));
foreach($aa as $caca) {
	$aaa=explode("|",trim($caca));
	if($aaa[3] !="") {
		$out.="<item>\n<title>".strip_tags(utf8_decode(stripslashes($aaa[3])))."</title>\n";
		$descr=substr(strip_tags(utf8_decode(stripslashes($aaa[4]))),0,120);
		$descr=str_replace('&','&amp;',$descr);
		$out.="<description>".$descr."...\n</description>\n";
		$out.="<link>"."http://".$path1."?id=".$aaa[0]."</link>\n";
		$out.="<guid>"."http://".$path1."?id=".$aaa[0]."</guid>\n";
		$out.="</item>\n";
	}
}
$out.="</channel>\n</rss>\n";
print $out;

function sv($s) {
	if (!isset($_SERVER)) {
		global $_SERVER;
		$_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
	}
	if (isset($_SERVER[$s]))return $_SERVER[$s];
	else return'';
}
?>
Return current item: BlogNEasy