Advertisement
Guest User

Untitled

a guest
Oct 19th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 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.         $post = Model_Post::find('first', array(
  29.             'where' => array(
  30.                 'id' => $id
  31.             )
  32.         ));
  33.         $data = array('post' => $post);
  34.         $this->template->title = $post->title;
  35.         $this->template->content = View::forge('blog/view', $data, false);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement