Navigation

WiredCMS Update

code.JPG

Well, I am still diligently working on WiredCMS (I know, I say that alot). I now have a valid RSS feed generated by it (WiredCMS RSS. RSS feeds are much easier than I originally thought, and with the backend I have built already, it took 29 lines of code to get RSS feeds going.

rss.php

  1. <?php
  2. function RSS(){
  3.         $const = get_defined_constants();
  4.         header('Content-type: text/xml');
  5.         print <<<EOF
  6.         <rss version="2.0">
  7.         <channel>
  8.         <title>{$const['SITE_NAME']}</title>
  9.         <description>{$const['SITE_SLOGAN']}</description>
  10.         <link>{$const['SITE_DOMAIN']}</link>
  11.         <copyright>WiredCMS 2008 Michael Conway - Wiredbyte</copyright>
  12. EOF;
  13.         $posts = Post::Read('1', 10);
  14.         foreach ($posts as $post){
  15.                 $pubDate = strftime( "%a, %d %b %Y %T %Z" , $post->created);
  16.                 print <<<EOF
  17.                 <item>
  18.                 <title>{$post->title}</title>
  19.                 <description>{$post->body}</description>
  20.                 <link>{$const['SITE_DOMAIN']}</link>
  21.                 <pubDate>{$pubDate}</pubDate>
  22.              </item>  
  23.                  
  24. EOF;
  25.         }
  26.         print '</channel>
  27.         </rss>';
  28. }
  29. ?>

Please keep in mind that I am using my own functions and classes for the above code, but I'll try to get a generic tutorial up for RSS feeds generation.

I've also got file uploads (images for posts at this point) working. though nothing is displayed yet, the files do get validated and uploaded. I also have set a config variable to adjust allowable file sizes, file types, and the upload path.