public function indexAction() { $arrayModel = array('funcao', 'escolaridade'); foreach ($arrayModel as $item) { $model = ucfirst($item) . 'Model'; $model = new $model(); $this->view->{$item} = $model->fetchAll(); } $model = new VagaModel(); $arrayCols = array('cidade', 'bairro', 'estado_civil', 'area_atuacao'); foreach ($arrayCols as $item) { $this->view->{$item} = $model->getItens($item); } $dicaModel = new DicaModel(); $noticiaModel = new NoticiaModel(); $this->view->dicas = $dicaModel->fetchAll($dicaModel->getDicaHome()); $this->view->noticias = $noticiaModel->fetchAll($noticiaModel->getNoticiaHome()); try { $twitterBusinnes = new TwitterBusiness(); $this->view->tweets = $twitterBusinnes->getTweets(); } catch (Exception $e) { } try { $this->view->videos = YouTubeBusiness::getVideos(); } catch (Exception $e) { } $model = new BlogPostModel(); $select = $model->select()->distinct()->from(array('p1' => 'wp_posts'), array('p1.id', 'p1.post_content', 'p1.post_title', 'p1.post_status', 'p1.post_parent', 'date_format(p1.post_date, \'%d/%m - %H:%i\') as post_date', 'p1.guid', 'p1.post_type'))->joinLeft(array('p2' => 'wp_posts'), 'p2.post_parent = p1.id AND p2.post_type = "attachment"', array('image_url' => 'p2.guid'))->order('p1.post_date DESC')->group('p1.id')->limit(4)->where('p1.post_status != ?', 'trash')->where('p1.post_status != ?', 'auto-draft')->where('p1.post_type = ?', 'post'); $rows = $model->fetchAll($select); $this->view->post = $rows; }