Location: PHPKode > projects > ViewSVN > templates/rss.php
<?php
header('Content-type: text/xml');

echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">\n";
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";

$uri = 'http://'. $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];

/* Required channel elements */
echo "<title>$page[project] repository: $page[path]</title>\n";
echo "<link>$uri</link>\n";
echo "<description>Subversion repository commits for project $page[project]</description>\n";

/* Optional elements */
echo "<generator>ViewSVN</generator>\n";
if (isset($config['rss_ttl'])) {
	echo "<ttl>$config[rss_ttl]</ttl>\n";
}

foreach ($page['items'] as $entry) {
	echo "<item>\n";

	$rev = sprintf("%05d", $entry['rev']);
	$msg_snippet = htmlspecialchars($entry['msg_snippet']);
	$msg = htmlspecialchars($entry['msg']);
	$author = $entry['author'];
	$changed_paths = 'Changed paths: <br/><ul>';
	foreach ($entry['paths'] as $p) {
		$changed_paths .= "<li>$p[action]: $p[path]</li>";
	}
	$changed_paths .= '</ul>';
	$date = $entry['date'];
	$time = $entry['time'];

	$pat_search = array(
		'/\${rev}/',
		'/\${msg_snippet}/',
		'/\${author}/',
		'/\${date}/',
		'/\${time}/',
		'/\${msg}/',
		'/\${changed_paths}/',
		);
	$pat_replace = array(
			$rev,
			$msg_snippet,
			$author,
			$date,
			$time,
			$msg,
			$changed_paths,
		);

	// title: revision and snippet of log entry
	$title = preg_replace($pat_search, $pat_replace, $config['rss_titleformat']);
	echo "\t<title>$title</title>\n";
	//echo "\t<author>$entry[author]</author>\n";
	echo "\t<link>$uri". makelink(array('do' => 'browse', 'project' => $page['project'], 'path' => $page['path'], 'rev' => $entry['rev'])) ."</link>\n";

	// unique identifier for the item
	echo "\t<guid isPermaLink=\"false\">$page[project]-r$entry[rev]</guid>\n";

	// the item body
	$description = htmlspecialchars(preg_replace($pat_search, $pat_replace, $config['rss_bodyformat']));
	echo "\t<description>$description</description>\n";
	/*
	echo "\t<description>"
	. $entry['date'] ." ". $entry['time']
	. "&lt;br/>\n"
	. htmlspecialchars($entry['msg'])
	. "&lt;br/>Changed paths:&lt;br/>\n"
	. "&lt;ul>\n";
	foreach ($entry['paths'] as $changed_path) {
		echo "&lt;li>$changed_path[action]: ". htmlentities($changed_path['path']) ."&lt;/li>\n";
	}
	echo "&lt;/ul>\n"
	. "\t</description>\n";
	*/

	echo "</item>\n";
}

echo "</channel>\n";
echo "</rss>\n";
?>
Return current item: ViewSVN