Beispiel #1
0
 public function editAction()
 {
     $id = $this->_request->getParam('id');
     $this->view->action = 'edit';
     if (!empty($id)) {
         $this->view->post_data = $this->_request->getParams();
         $post_model = new Application_Model_Post();
         $posts = $post_model->getPostById($id);
         $this->view->post = $posts[0];
     }
     if ($this->_request->isPost()) {
         $post_data = $this->_request->getParams();
         //var_dump($post_data);
         $post_model = new Application_Model_Post();
         $post_model->editPost($id, array("title" => $post_data['title'], "body" => $post_data['postbody']));
         $posts = $post_model->getPostById($id);
         $this->view->post = $posts[0];
     }
     $this->render('add');
     //$post=new Application_Model_Post()
     // $post->editPost($this->$id,);
 }