public static function posts($data)
 {
     $posts = PostModel::all();
     if (count($posts)) {
         View::show('posts', $posts);
     } else {
         View::error('There is no posts');
     }
 }
示例#2
0
 /** @param PostModel $model */
 protected function extractInfoFromModel(&$model)
 {
     $this->title = $model->getTitle();
     $this->subtitle = $model->getSubtitle();
     $this->author = $model->getAuthor();
     // convert date to a human readable format
     $this->date = date("F jS, Y", strtotime($model->getDate()));
     $this->postBody = $model->getPostBody();
 }