Example #1
0
 public function insert()
 {
     $insert = $this->input->post('insert');
     if ($insert == 'insert') {
         $title = $this->input->post('post-title');
         $body = $this->input->post('post-body');
         $post = new Post();
         $post->setTitle($title);
         $post->setBody($body);
         $post->setPublicationDate(new \DateTime());
         $this->em->persist($post);
         $this->em->flush();
         redirect('blog', 'refresh');
     }
     $content['title'] = "Create a new post";
     $data['content'] = $this->load->view('blog/insert', $content, true);
     $this->load->view('main', $data);
 }
Example #2
0
 public function getTitle()
 {
     if ($this->thread) {
         return $this->thread->getTitle();
     }
     return $this->title;
 }