Skip to content

Commit

Permalink
Added news page
Browse files Browse the repository at this point in the history
  • Loading branch information
katzgrau committed Dec 11, 2011
1 parent 395e1c1 commit b67659c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
$route['ajax/packages/(:any)/rate'] = "ajax/packages/rate/$1";
$route['home'] = "home/index";
$route['news'] = "home/news";
$route['download'] = "home/download";
$route['set-up'] = "home/set_up";
$route['set-up-mx'] = "home/set_up_mx";
Expand Down
7 changes: 7 additions & 0 deletions application/controllers/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ function project()
$this->load->view('home/project');
}

function news()
{
$this->load->model('news');
$data['items'] = News::getRecent(100);
$this->load->view('home/news', $data);
}

/**
* The installation script
*/
Expand Down
2 changes: 2 additions & 0 deletions application/controllers/packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ public function is_owner($spark_id)

function summary()
{
UtilityHelper::tryPageCache(1);

$this->load->model('spark');
$items_per = 5;

Expand Down
29 changes: 29 additions & 0 deletions application/views/home/news.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php $this->load->view('global/_new_header.php', array('title' => 'Latest News')); ?>

<h2>GetSparks.org Community News</h2>

<p>
<strong>News about sparks from blogs and other places. Want to announce
something? Tweet <a href="http://twitter.com/getsparks">@getsparks</a>.</strong>
</p>

<table class="spark-table">
<thead>
<tr>
<th>Story</th>
<th>Source</th>
<th>Posted</th>
</tr>
</thead>
<tbody>
<?php foreach($items as $item): ?>
<tr>
<td><a href="<?php echo $item->url ?>"><?php echo $item->title ?></a></td>
<td><?php echo parse_url($item->url, PHP_URL_HOST) ?></td>
<td><?php echo date('F j, Y', strtotime($item->posted)); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

<?php $this->load->view('global/_new_footer.php'); ?>

0 comments on commit b67659c

Please sign in to comment.