<?php

// log the hit.. (you're gonna log them, surely!)
@include $_SERVER['DOCUMENT_ROOT'].'/inc/init.php';

// send correct header..
header('content-type: application/rss+xml'); 
require(
'config.php');

echo 
'<?xml version="1.0" encoding="UTF-8"?>',"\n";
echo 
'<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"';
echo 
' "http://my.netscape.com/publish/formats/rss-0.91.dtd">'."\n";
echo 
'<rss version="0.91">',"\n\n";
echo 
'<channel>',"\n";
echo 
'<title>',$mysite,'</title>',"\n";
echo 
'<link>',$blogurl,'</link>',"\n";
echo 
'<description>',$description,'</description>',"\n";
echo 
'<language>en-gb</language>',"\n\n";
echo 
'<copyright>copyright 2004 - ',$mydomain,'</copyright>',"\n";
echo 
'<managingEditor>',$emailaddress,'</managingEditor>',"\n";
echo 
'<webMaster>',$emailaddress,'</webMaster>',"\n\n";
echo 
'<image>',"\n";
echo 
'<title>',$mysite,'</title>',"\n";
echo 
'<url>',$blogurl,'inc/img/corzblog.png</url>',"\n";
echo 
'<link>',$blogurl,'</link>',"\n";
echo 
'</image>',"\n\n";

// read and split the blog into an array of blog entries..
$file_contents implode(''file($filename));
$whole_blog explode('<!--*end*-->'$file_contents); 

// start the loop..
$total_articles count ($whole_blog); 
for (
$i=0;$i $total_articles;$i++) { 
    
$z $i 1;
    
    if (
$z == $total_articles) {
        break; 
// we reached the end of the articles
    
} else {
        
$blog $whole_blog[$i];
        
        
// split the article into its parts..
        
$parts explode('<!--*g*-->'$blog); 
        
$blog_title strip_tags($parts[1]); // the title
        
        // we need a valid "encoded" version of the link..
        
$enc_title rawurlencode(strip_tags($parts[1]));

        
// grab the first two paragraphs for the news preview.
        // it may go over 500 chrs, och well, we could check for that.
        
$the_blog explode('<br />'$parts[2]);
        
$snippet htmlspecialchars(strip_tags($the_blog[0])) 
            .
htmlspecialchars(strip_tags($the_blog[1]))
                .
htmlspecialchars(strip_tags($the_blog[2])); // what a pain!
        
        // now create the <item> element..
        
echo '<item>',"\n";
        echo 
'<title>',$blog_title,'</title>',"\n";
        echo 
'<description>',$snippet,' ...</description>',"\n";
        echo 
'<link>',$blogurl,'index.php#',$enc_title,'</link>',"\n";
        echo 
'</item>',"\n\n";
    }
// and loop until we reach the end of the blog

echo '</channel>',"\n";
echo 
'</rss>';
?>
back to the source menu
test

Welcome to corz.org!

If something isn't working, I'm probably improving it, try again in a minute. If it's still not working, please mail me!