Advertisement
Guest User

Untitled

a guest
Oct 19th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. class Controller_Blog extends Controller_Template
  4. {
  5.     /**
  6.      * Page D'index du blog
  7.      *
  8.      * @access  public
  9.      * @return  Response
  10.      */
  11.     public function action_index()
  12.     {
  13.         $posts = Model_Post::find('all');
  14.         $data = array('posts' => $posts);
  15.         $this->template->title = 'Créatux : Blog';
  16.         $this->template->content = View::forge('blog/index', $data, false);
  17.     }
  18.  
  19.  
  20.     /**
  21.      * Page de vue d'un article
  22.      *
  23.      * @access  public
  24.      * @return  Response
  25.      */
  26.     public function action_view($id)
  27.     {
  28.         if ($id and ctype_digit($id) and $post = Model_Post::find($id))
  29.         {
  30.             $data = array('post' => $post);
  31.             $this->template->title = $post->title;
  32.             $this->template->content = View::forge('blog/view', $data, false);
  33.         }
  34.         else
  35.         {
  36.             // handle your not-found
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement