/** * 文章详细 * @param int $id 文章id */ public function post($id = -1) { $Posts = new PostsLogic(); $post_res = $Posts->detail($id, true); $res_array = array(); if (!$post_res) { $this->jsonReturn(0, '没有找到文章'); } else { $post_res['post_content'] = strip_tags($post_res['post_content']); $post_res['url'] = U('Api/Index/post', array('id' => $post_res['post_id']), false, true); $this->jsonReturn(1, $post_res); } }
/** * 未知类型单页显示 支持年月日限定 * @param $method 魔术方法名称 即文章类型 * @param $args */ public function _empty($method, $args) { //TODO 通用模板机制 $Posts = new PostsLogic(); $info = I('get.info'); $post_detail = $Posts->detail($info, true); $Posts->viewInc($post_detail['post_id']); $this->assign('post', $post_detail); // 赋值数据集 if (File::file_exists(T('Home@Post/' . $post_detail['post_template']))) { $this->display($post_detail['post_template']); } else { //TODO 这里怎么处理却决于你自己了。 $this->error404('缺少对应的模版而不能显示'); // $this->display('single'); } // $this->display($post_res['post_type']); }