<?php
/**
* @author Kjell-Inge Gustafsson <hide@address.com>
* @copyright copyright (c) 2006 Kjell-Inge Gustafsson kigkonsult
* @link www.kigkonsult.se/rsscalCreator/index.php hide@address.com
*
* License:
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* ensure the right path to class file */
require_once './rsscalCreator.class.php';
/* SETUP !!! directory to store feed file */
define( 'CACHE', './cache' );
/* initiate */
$feed = new rsscalCreator();
/* set feed directory and filename */
$feed->setFilename( CACHE, 'test.rss' );
/* insert all required and some optional elements */
$channel = new rsscalChannel( 'RSSCAL feed sample'
, 'http://www.kigkonsult.se/rsscalCreator/index.php'
, 'A RSSCAL feed sample'
);
$channel->addElement( 'dc:date', date( 'Y-m-d' ));
$channel->addElement( 'dc:rights', 'Copyright 2006 kigkonsult' );
$feed->setChannel( $channel );
/* use a while/for/foreach-loop to set the items */
// foreach( $databaseQueryResult as $data ) {
for( $x=1; $x<10; $x++ ) { // fake some demo data
/* set items subelements, title (required), link (required), description (optional) */
$item = new rsscalItem( "Reunion $x"
, "http://www.org.com/lib $x?var=x$x&x2=x2$x"
, "Anniversary exhibition $x"
);
/* add optional item subelement, one by one (element name, element content) to item */
$item->addElement( 'ev:type', "category $x" );
$item->addElement( 'ev:organizer', "manager$hide@address.com" );
$item->addElement( 'ev:location', "Room no $x" );
$item->addElement( 'ev:startdate', "201$x-11-01" );
$item->addElement( 'ev:enddate', "201$x-11-01" );
$item->addElement( 'dc:subject', "Subject $x" );
/* add item to feed */
$feed->addItem( $item );
}
/* insert required image (and optional) elements */
$image = new rsscalImage( 'imagetitle'
, 'http://www.RSSquestionnaire.org'
, 'http://www.RSSquestionnaire.org/images/image.png'
);
$image->addElement( 'dc:language', 'en' );
$feed->setImage( $image );
/* insert required textinput (and optional) elements */
$textinput = new rsscalTextinput( "Make a question!"
, "Ask anything about RSS"
, "question"
, "http://www.RSSquestionnaire.org/ask.php"
);
$textinput->addElement( 'dc:language', 'en' );
$feed->setTextinput( $textinput );
/* create, save feed file and redirect feed to browser */
$feed->returnRSS();
?>