/** * Specifically for Blog actions. */ public function indexAction() { $blog = new Application_Model_BlogMapper(); $this->view->entries = $blog->fetchAll(); $comments = new Application_Model_CommentsMapper(); $this->view->centries = $comments->fetchAll(); $request = $this->getRequest(); $form = new Application_Form_Blog(); if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $blog = new Application_Model_Blog($form->getValues()); $mapper = new Application_Model_BlogMapper(); $mapper->save($blog); return $this->_helper->redirector('index'); } } $this->view->form = $form; /* $comments = new Application_Model_CommentsMapper(); $this->view->comments = $comments->fetchAll(); $request = $this->getRequest(); $form = new Application_Form_Comments(); if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $comment = new Application_Model_Comments($form->getValues()); $mapper = new Application_Model_CommentsMapper(); $mapper->save($comment); return $this->_helper->redirector('index'); } } $this->view->form = $form;*/ }
public function commentsAction() { $request = $this->getRequest(); $form = new Application_Form_Comments(); if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $comment = new Application_Model_Comments($form->getValues()); $mapper = new Application_Model_CommentsMapper(); $mapper->save($comment); return $this->_helper->redirector('index'); } } $this->view->form = $form; }