summaryrefslogtreecommitdiff
path: root/includes/test_script.php
blob: 2c99748e7e09ed21e8cc20f38f5bf9b6b0378515 (plain)
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
<?php

use Bitweaver\Rss\UniversalFeedCreator;
use Bitweaver\Rss\FeedImage;
use Bitweaver\Rss\FeedItem;

$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "PHP news";
$rss->description = "daily news from the PHP scripting world";

//optional
//$rss->descriptionTruncSize = 500;
//$rss->descriptionHtmlSyndicated = true;
//$rss->xslStyleSheet = "http://feedster.com/rss20.xsl";

$rss->link = "http://www.dailyphp.net/news";
$rss->feedURL = "http://www.dailyphp.net/".$_SERVER['SCRIPT_NAME'];

$image = new FeedImage();
$image->title = "dailyphp.net logo";
$image->url = "http://www.dailyphp.net/images/logo.gif";
$image->link = "http://www.dailyphp.net";
$image->description = "Feed provided by dailyphp.net. Click to visit.";

//optional
$image->descriptionTruncSize = 500;
$image->descriptionHtmlSyndicated = true;

$rss->image = $image;

// get your news items from somewhere, e.g. your database:
//mysql_select_db($dbHost, $dbUser, $dbPass);
//$res = mysql_query("SELECT * FROM news ORDER BY newsdate DESC");
//while ($data = mysql_fetch_object($res)) {
	$item = new FeedItem();
	$item->title = "This is an the test title of an item";
	$item->link = "http://localhost/item/";
	$item->description = "<b>description in </b><br/>HTML";

	//optional
	//item->descriptionTruncSize = 500;
	$item->descriptionHtmlSyndicated = true;

	$item->date = time();
	$item->source = "http://www.dailyphp.net";
	$item->author = "John Doe";

	$rss->addItem($item);
//}

// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1, MBOX, OPML, ATOM0.3, HTML, JS
echo $rss->saveFeed("RSS0.91", "feed.xml");