MVC-Pro/application/controllers/blogcontroller.php
/**
	 * Description:
	 * Sets the key of 'post' in the Controller's $data array and pulls in the data from the database
	 * as the value, matching it with they key of 'post'
	 *
	 * @param  int 	  $pID  the ID of the post
	 * @return object $post contains all the data from the post
	 */


@param  int    $pID  the ID of the post
@return object $post contains all the data from the post
@param int $pID the ID of the post @return object $post contains all the data from the post
public function post($pID)
   	{
		$this->commentObject = new Comment();
		$this->postObject = new Post();
   		if (!empty($_POST['action']) && 'Add Comment' == $_POST['action']) {
   			$data = array(
					'uID'         => $_POST['uID'],
					'postID'      => $_POST['postID'],
					'commentText' => $_POST['commentText']
			);
   			$message = $this->commentObject->addComment($data);
   		}
   		$u = new User();
   		if ($u->isAdmin() && !empty($_POST['action']) && 'Delete' == $_POST['action']) {
   			$this->commentObject->deleteComment($_POST['commentID']);
   		}
   		$this->set('comments', $this->commentObject->getCommentsByPostID($pID));
		$post = $this->postObject->getPost($pID);
	  	$this->set('post', $post);
   	}
public function post ( $ pID ) { $ this -> commentObject = new Comment ( ) ; $ this -> postObject = new Post ( ) ; if ( ! empty ( $ _POST [ 'action' ] ) && 'Add Comment' == $ _POST [ 'action' ] ) { $ data = array ( 'uID' => $ _POST [ 'uID' ] , 'postID' => $ _POST [ 'postID' ] , 'commentText' => $ _POST [ 'commentText' ] ) ; $ message = $ this -> commentObject -> addComment ( $ data ) ; } $ u = new User ( ) ; if ( $ u -> isAdmin ( ) && ! empty ( $ _POST [ 'action' ] ) && 'Delete' == $ _POST [ 'action' ] ) { $ this -> commentObject -> deleteComment ( $ _POST [ 'commentID' ] ) ; } $ this -> set ( 'comments' , $ this -> commentObject -> getCommentsByPostID ( $ pID ) ) ; $ post = $ this -> postObject -> getPost ( $ pID ) ; $ this -> set ( 'post' , $ post ) ; }
Description:
 Sets the key of 'post' in the Controller's $data array and pulls in the data from the database
 as the value, matching it with they key of 'post'
Description : Sets the key of ' post ' in the Controller ' s $data array and pulls in the data from the database as the value matching it with they key of ' post '
// instantiate the comment class // instantiate the post class // If the user is submitting a comment. // Delete comments // $this->set('user', $this->commentObject->getUser()) // this is pulling in the the data from the row in the database and storing it in $post // changing date format // $post['date'] = date('F jS', strtotime($post['date'])); // Sets the key of 'post' in the Controller's $data array and pulls in the data from the database as the value, matching it with they key of 'post'