PHP Classes

File: example-array.php

Recommend this page to a friend!
  Classes of Pavel   Feeder   example-array.php   Download  
File: example-array.php
Role: Example script
Content type: text/plain
Description: Example - dynamically generating feed from arrays.
Class: Feeder
Generate feeds in RSS and Atom formats
Author: By
Last change: Accessible without user login
Date: 11 years ago
Size: 1,175 bytes


Class file image Download
require_once 'feeder.php';

$channel = array(
'title' => 'My Feed',
'author' => 'Proger_XP',
'description' => 'Just another PHP Feed',
'baseurl' => 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI']).'/',

$entries = array(
'title' => 'My first post',
'updated' => strtotime('22 Jan 2011'),
'author' => 'Proger_XP',
'content' => 'Thinking about something to write...',
'content html' => 'Thinking about <em>something</em> to write&hellip;',
'title' => 'Another filler',
'updated' => strtotime('23 May 2012'),
'author' => 'Proger_XP',
'contributor' => 'Camilo',
'content html' => 'Why? Because he\'s my friend <img src="smile.png" />',

$feeder = new Feeder;

foreach (
$entries as $i => $entry) {
$feeder->Entry($i, new FeedEntry($entry));

$output = new AtomFeed;