From ded46a292ab1afda4a6bf1b3c767eb02db49bf05 Mon Sep 17 00:00:00 2001 From: Dave Widmer Date: Wed, 7 Dec 2011 16:36:23 -0500 Subject: [PATCH] Getting the main blog page up and running. --- classes/controller/soapbox.php | 39 +----------------- classes/soapbox/controller.php | 55 ++++++++++++++++++++++++++ views/soapbox/list.php | 4 +- views/soapbox/{single.php => post.php} | 13 +----- 4 files changed, 60 insertions(+), 51 deletions(-) create mode 100644 classes/soapbox/controller.php rename views/soapbox/{single.php => post.php} (59%) diff --git a/classes/controller/soapbox.php b/classes/controller/soapbox.php index a3d247e..0f83313 100644 --- a/classes/controller/soapbox.php +++ b/classes/controller/soapbox.php @@ -1,40 +1,3 @@ + * @copyright 2011 © Dave Widmer + */ +class Soapbox_Controller extends Controller_Template +{ + /** + * @var array An array of configuration values + */ + protected $_config; + + /** + * Get the configuration + */ + public function before() + { + $this->_config = Kohana::$config->load('soapbox'); + return parent::before(); + } + + /** + * Views the current posts. + */ + public function action_index() + { + $page = $this->request->param('page', 1); + + $this->template->title = $this->_config['title']; + $this->template->content = View::factory('soapbox/list')->set(array( + 'posts' => Model::factory('post')->fetch($this->_config['per_page'], $page), + )); + } + + /** + * Lists the posts in a given category + */ + public function action_category() + { + die('This is where you will show a list of posts with the given category'); + } + + /** + * View a single post + */ + public function action_post() + { + die('Here is where you will show a single post'); + } + +} diff --git a/views/soapbox/list.php b/views/soapbox/list.php index a921a0a..371d6d3 100644 --- a/views/soapbox/list.php +++ b/views/soapbox/list.php @@ -1,9 +1,9 @@ -

+

set((array) $post); + echo View::factory('soapbox/post')->set((array) $post); } diff --git a/views/soapbox/single.php b/views/soapbox/post.php similarity index 59% rename from views/soapbox/single.php rename to views/soapbox/post.php index e2be2b3..3a3ff80 100644 --- a/views/soapbox/single.php +++ b/views/soapbox/post.php @@ -1,16 +1,7 @@ - -

Posted:
- +
+
\ No newline at end of file