Login   Register  
PHP Classes
elePHPant
Icontem

File: USAGE

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of James Logdson  >  Syndication Classes  >  USAGE  >  Download  
File: USAGE
Role: Documentation
Content type: text/plain
Description: USAGE File
Class: Syndication Classes
Generate XML and RSS feeds
Author: By
Last change:
Date: 2005-05-01 15:24
Size: 1,087 bytes
 

Contents

Class file image Download
USAGE for Syndication Classes

class XML
++++++++++++++++++++++++++++++++++++++++
$XML = new XML ( "1.0" );

// Uncomment to enable debugging
//$XML->debug = true;

$XML->openTag ( 'myTag' );
$XML->openTag ( 'anotherTag', array ( 'attribute'=>'value','perm'=>'true' ) );
$XML->addValue ( 'This tag has attributes' );
$XML->openTag ( 'thisHasNoClose', null, true );
$XML->closeTag ( ); // Closes 'anotherTag'
$XML->closeTag ( ); // Closes 'myTag'

echo $XML->Go(); // Output

class RSS
++++++++++++++++++++++++++++++++++++++++
$info = Array (
	'title'       => 'Site Title',
	'link'        => 'http://example.com',
	'description' => 'Some information on the site',
	'pubDate'     => date ( 'r' ),
	'category'    => 'Personal'
);

$RSS = new RSS ( $info );

// Add posts
$post[1] = Array (
	'title'       => 'Post Title',
	'link'        => 'http://site.com/post/1',
	'description' => 'The post goes here for real',
	'author'      => 'Admin',
	'guid'        => array('http://site.com/post/1',true),
	'pubDate'     => date ( 'r' )
);

foreach ( $post as $info )
{
	$RSS->addItem ( $info );
}