beginnings of NAA data import
[disclosr.git] / lib / FeedWriter / examples / example_minimum.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<<<<<<< HEAD
<?php
 
/* 
 * Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
 *
 * This file is part of the "Universal Feed Writer" project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
* 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
  // This is a minimum example of using the class
  include("../FeedTypes.php");
  
  //Creating an instance of RSS2FeedWriter class. 
  $TestFeed = new RSS2FeedWriter();
  
  //Setting the channel elements
  //Use wrapper functions for common channel elements
  $TestFeed->setTitle('Testing & Checking the RSS writer class');
  $TestFeed->setLink('http://www.ajaxray.com/projects/rss');
  $TestFeed->setDescription('This is a test of creating a RSS 2.0 feed Universal Feed Writer');
  
  //Image title and link must match with the 'title' and 'link' channel elements for valid RSS 2.0
  $TestFeed->setImage('Testing the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/_resources/img/logo.png');
  
  //Let's add some feed items: Create two empty FeedItem instances
  $itemOne = $TestFeed->createNewItem();
  $itemTwo = $TestFeed->createNewItem();
  
  //Add item details
  $itemOne->setTitle('The title of the first entry.');
  $itemOne->setLink('http://www.google.de');
  $itemOne->setDate(time());
  $itemOne->setDescription('And here\'s the description of the entry.');
  $itemTwo->setTitle('Lorem ipsum');
  $itemTwo->setLink('http://www.example.com');
  $itemTwo->setDate(1234567890);
  $itemTwo->setDescription('Lorem ipsum dolor sit amet, consectetur, adipisci velit');
  
  //Now add the feed item
  $TestFeed->addItem($itemOne);
  $TestFeed->addItem($itemTwo);
  
  //OK. Everything is done. Now genarate the feed.
  $TestFeed->generateFeed();
  
?>
=======
<?php
 
// You should use an autoloader instead of including the files directly.
// This is done here only to make the examples work out of the box.
include('../Item.php');
include('../Feed.php');
include('../RSS2.php');
 
date_default_timezone_set('UTC');
 
use \FeedWriter\RSS2;
 
/* 
 * Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
 *
 * This file is part of the "Universal Feed Writer" project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
//Creating an instance of RSS2 class.
$TestFeed = new RSS2;
 
//Setting the channel elements
//Use wrapper functions for common channel elements
$TestFeed->setTitle('Testing & Checking the RSS writer class');
$TestFeed->setLink('http://www.ajaxray.com/projects/rss');
$TestFeed->setDescription('This is a test of creating a RSS 2.0 feed Universal Feed Writer');
 
//Image title and link must match with the 'title' and 'link' channel elements for valid RSS 2.0
$TestFeed->setImage('Testing & Checking the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/_resources/img/logo.png');
 
//Let's add some feed items: Create two empty Item instances
$itemOne = $TestFeed->createNewItem();
$itemTwo = $TestFeed->createNewItem();
 
//Add item details
$itemOne->setTitle('The title of the first entry.');
$itemOne->setLink('http://www.google.de');
$itemOne->setDate(time());
$itemOne->setDescription('And here\'s the description of the entry.');
 
$itemTwo->setTitle('Lorem ipsum');
$itemTwo->setLink('http://www.example.com');
$itemTwo->setDate(1234567890);
$itemTwo->setDescription('Lorem ipsum dolor sit amet, consectetur, adipisci velit');
 
//Now add the feed item
$TestFeed->addItem($itemOne);
$TestFeed->addItem($itemTwo);
 
//OK. Everything is done. Now generate the feed.
$TestFeed->printFeed();
>>>>>>> origin/master