Open-Source PHP Framework - Designed for rapid development of performance-oriented scalable applications

RSS layout

API >> mvc >> layouts >> rss

Generates an RSS 2.0 or Atom feed.

String variables are:
  • $title - (Required) title of your feed
  • $baseUrl - the base URL of your web site, including protocol (http://) - if $baseUrl is omitted Vork will try to create one from the SITE_DOMAIN constant set in the .config file.
  • $description - (Required) description of your feed
  • $head['meta']['description'] - alias for $description, you can use this instead of $description if your script is already sending out a meta description for the other layouts
  • $articles - (Required) The articles to syndicate should be sent in the $articles array, each article needs a key for:
    • title
    • description - the content of your feed
    • fullname - name of the person who created the content
    • urlname - the part of the URL that appears after the baseUrl, with MVC this is usually controllerName/actionName
    • publishedDateTime

The publishedDateTime is very flexible and can accept any format of the PHP strtotime() function eg.:
$articles[] = array(
    
'urlname' => 'news/monkeys-escape-zoo'
    
'title' => 'Monkeys break out of zoo'
    
'description' => 'Lots of chimps run free looting bananas from...'
    
'fullname' => 'B.J. McKay'
    
'publishedDateTime' => '09/24/09 4:00pm'
); 
$articles[] = array(
    
'urlname' => 'releases/version2'
    
'title' => 'Hot off the press V2.0!'
    
'description' => 'Version 2.0 of software released and is...'
    
'fullname' => 'Troy McLure'
    
'publishedDateTime' => 'Monday, September 24 2009 7:30pm EST'
); 
$articles[] = array( 
    
'urlname' => 'news/record-heat'
    
'title' => 'High temps wreak havoc for datacenters'
    
'description' => 'Freak heat wave racks up HVAC bills for many datacenters...'
    
'fullname' => 'Martha Reeves'
    
'publishedDateTime' => 'Sep. 24, 2009 21:45:00'
);

Feed image

If you would like to add a logo image with your RSS feed you can add the image to the /webroot/images folder and then uncomment out the line at the top of the RSS layout:
$logo $baseUrl '/images/YOURLOGO.jpg';

Generating an Atom feed

The default feed format is RSS 2.0; to generate an Atom feed add to the query string of the page: feed=atom
So the page http://www.YourSite.com/rss would become http://www.YourSite.com/rss?feed=atom