public function editAction() { $id = (int) $this->getRequest()->getParam('id'); $form = new Admin_Form_Posts_Edit(); $model = new App_Model_Posts(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $model->updatePost($form->getValues(), $id); $this->_helper->flashMessenger->addMessage('Edited'); return $this->_redirect('/admin/posts'); } } if ($id > 0) { $posts = $model->fetchRow('id=' . $id); $form->populate($posts->toArray()); } $this->view->form = $form; }
public function getMenuXML() { $menu_pages = $this->fetchAll(array('active = 1', "type = 'page'"), 'order'); $news = new App_Model_News(); $menu_news = $news->fetchAll(array('active = 1'), 'created DESC', 10); $posts = new App_Model_Posts(); $menu_posts = $posts->fetchAll(array('active = 1'), 'created DESC', 10); Zend_Debug::dump($menu_pages, 'Pages'); }
public function viewAction() { $title = $this->getRequest()->getParam('item'); $model = new App_Model_Posts(); $this->view->post = $model->fetchRow(array("title ='" . $title . "'")); }
public function getMenuXML() { $this->_name = 'page_test'; $menu_pages = $this->fetchAll(array('active = 1', "type = 'page'"), 'created ASC'); $news = new App_Model_News(); $menu_news = $news->fetchAll(array('active = 1'), 'created DESC', 10); $posts = new App_Model_Posts(); $menu_posts = $posts->fetchAll(array('active = 1'), 'created DESC', 10); $i = 0; foreach ($menu_pages as $row) { $this->menuRecursion($row); } return $this->menuArray; Zend_Debug::dump($this->menuArray, 'Pages'); }