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

App Directory >> CakePHP RSS + XML + Time by Ajay AnturkarAjay Anturkar

Download this App

package
CakePHP RSS + XML + Time
version
1.0.0
license
MIT (X11)

CakePHP RSS + XML + Time

RSS Helper


Sample View File


    $rss 
get::helper('rss');
    if (!isset(
$documentData)) {
        
$documentData = array();
    }
    if (!isset(
$channelData)) {
        
$channelData = array();
    }
    if (!isset(
$channelData['title'])) {
        
$channelData['title'] = "Test title";
    } 
    
$documentData = array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/');

    
$channelData= array(
        
'title' => 'Most Recent Posts',
        
'link' => 'http://www.yourwebsite.com/path/',
        
'description' => 'Test Description.',
        
'language' => 'en-us');
             
    
$content_for_layout=$rss->item(array(), array(
        
'title' => 'Test Title ',
        
'link' => 'http://www.yourwebsite.com',
        
'guid' => array('url' => 'http://www.yourwebsite.com''isPermaLink' => 'true'),
        
'description' =>  'Test Description',
        
'creator' => 'Creator Name',
        
'pubDate' => '2011-06-25 07:12:16'));
          
    
$channel $rss->channel(array(), $channelData$content_for_layout);
    echo 
$rss->document($documentData,$channel);

Time Helper


It allows for the quick processing of time related information. The Time Helper has two main tasks that it can perform:


Functions


How to use Time Helper



$time 
get::helper('time');
echo 
$time->nice('1206975600');// Output: Mon, Mar S 2008, 10:00

XML Helper


The XML Helper simplifies the output of XML documents.


echo $this->Xml->serialize($data); 


echo $this->Xml->elem('count'null, array('cdata'=>true,'value'=>'content'));


echo $this->Xml->header(); 


App Files