Skip to content

Commit

Permalink
Homepage: Collate news content from all feeds into one time line
Browse files Browse the repository at this point in the history
No need for anything fancy at this stage as this mechanism will be
replaced entirely in the near future.
  • Loading branch information
danij-deng committed Jul 1, 2013
1 parent 7af3f01 commit e4554d5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
46 changes: 40 additions & 6 deletions web/classes/frontcontroller.class.php
Expand Up @@ -311,21 +311,55 @@ private function generateFeedHtml(&$feed, $maxItems = 3,
private function outputNewsFeed()
{
require_once(DIR_CLASSES.'/feed.class.php');

$newsContent = array();
{
$maxItems = 3;
$feed = new Feed('http://dengine.net/forums/rss.php?mode=news');
$this->generateFeedHtml($feed, 3, 'Project News', 'projectnews-label');
$n = (int) 0;
foreach($feed as $item)
{
$newsContent[$item->timestamp] = $this->generateFeedItemHtml($item);
if(++$n >= $maxItems) break;
}
}
{
$maxItems = 3;
$params = array('titleTemplate'=>'{title} complete',
'labelTemplate'=>'Read more about {title}, completed on {timestamp}');

$feed = new Feed('http://dl.dropboxusercontent.com/u/11948701/builds/events.rss');
$this->generateFeedHtml($feed, 3, 'Build News', 'projectnews-label',
array('titleTemplate'=>'{title} complete',
'labelTemplate'=>'Read more about {title}, completed on {timestamp}'));
$n = (int) 0;
foreach($feed as $item)
{
$newsContent[$item->timestamp] = $this->generateFeedItemHtml($item, $params);
if(++$n >= $maxItems) break;
}
}
{
$maxItems = 3;
$params = array('labelTemplate'=>'Read more about {title}, posted on {timestamp}');

$feed = new Feed('http://dengine.net/forums/rss.php?f=24');
$this->generateFeedHtml($feed, 3, 'Developer Blog', 'projectnews-label',
array('labelTemplate'=>'Read more about {title}, posted on {timestamp}'));
$n = (int) 0;
foreach($feed as $item)
{
$newsContent[$item->timestamp] = $this->generateFeedItemHtml($item, $params);
if(++$n >= $maxItems) break;
}
}

?><span class="projectnews-label">Latest news</span>
<ul><?php

krsort($newsContent, SORT_NUMERIC);
foreach($newsContent as &$contentItemHtml)
{
?><li><?php echo $contentItemHtml; ?></li><?php
}

?></ul><?php

}

/**
Expand Down
3 changes: 1 addition & 2 deletions web/style.css
Expand Up @@ -646,7 +646,7 @@ p.legal a {
position: relative;
top: -275px; /* minus (image height - divider height) */
min-width: 201px;
padding-left: .5em;
padding-left: 1.3em;
padding-top: .5em;
float: left;
text-align: left;
Expand All @@ -660,7 +660,6 @@ p.legal a {

#projectnews ul {
padding: 0;
margin-left: 1.8em;
margin-top: .4em;
}

Expand Down

0 comments on commit e4554d5

Please sign in to comment.