Ejemplo n.º 1
0
 /**
  * Metodo llamado por la función INDEX.
  * @return array
  */
 protected function dataIndex()
 {
     $posts = Posts::selectAll();
     $output = [];
     if ($posts !== \FALSE) {
         $output = $posts->getAll();
     }
     return ['posts' => $output];
 }
Ejemplo n.º 2
0
 /**
  * Metodo llamado por la función INDEX.
  * @return array
  */
 protected function dataIndex()
 {
     $posts = Posts::selectAll();
     $output = [];
     if ($posts !== \FALSE) {
         $output = $posts->getAll();
     }
     foreach ($output as $post) {
         $title = $post->getPostTitle();
         if (isset($title[30])) {
             $title = substr($title, 0, 30) . ' [...]';
         }
         $post->setPostTitle($title);
     }
     return ['posts' => $output];
 }