1 <?php
2
3 class WebylonNews extends DashboardPlugin {
4 static $position = "left";
5 static $sort = 1;
6 static $title = "Webylon News";
7 static $icon = "dashboard/images/22/feed.png";
8
9 10 11
12 static = 'http://webylon.ru/stuff/rss.php?v=3.1';
13
14 15 16 17 18
19 function LatestSSNews() {
20 $sp23 = Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/simplepie.php');
21 $sp24 = Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/simplepie.inc');
22
23 if(file_exists($sp23))
24 include_once $sp23;
25 elseif(file_exists($sp24))
26 include_once $sp24;
27
28 $output = new DataObjectSet();
29
30 $feed = new SimplePie(self::$rss_url, TEMP_FOLDER);
31 $feed->init();
32 if($items = $feed->get_items(0, 2)) {
33 foreach($items as $item) {
34
35
36 $date = new Date('Date');
37 $date->setValue($item->get_date());
38
39
40 $title = new Text('Title');
41 $title->setValue($item->get_title());
42
43
44 $desc = new HTMLText('Description');
45
46 $desc->setValue($item->get_description());
47
48 $output->push(new ArrayData(array(
49 'Title' => $title,
50 'Date' => $date,
51 'Link' => $item->get_link(),
52 'Description' => $desc
53 )));
54 }
55 return $output;
56 }
57 }
58 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-