<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ViewAction
 *
 * @author yzxh24
 */
class ViewAction extends BaseAction
{
    public function run()
    {
        if (isset($_GET['pid']))
        {
            $post = BookPostReplys::model()->find('postid=:pid AND isfirst = 1', array(':pid'=>intval($_GET['pid'])));
            if (empty($post))
            {
                throw new CHttpException(500,'不存在的高级贴');
            }
        }
        else
        {
            $id = intval($_GET['id']);
            $post = BookPostReplys::model()->findByPk($id);
        }

        //print_r($post);die;
        $this->getController()->render('view',array('post'=>$post));
    }
}