public function diypage(){
$id = $_GET['id'];
if(!is_numeric($id)){
$this -> error('自定义页参数不正确!',U('index'),3);
}
//读取自定义页面信息
$qinfo = M('diypage') -> find($id);
if(is_null($qinfo)){
$this -> error('该自定义页不存在或已被删除!',U('index'),3);
}
$tpl = $qinfo['tpl'];
$tpl = str_ireplace('.html','',$tpl);
//是否存在模板嵌套
if(!is_null($tpl)){$tpl='common_default';} //默认只包含一个{tag:inside}的模板文件,不通过它 不能解析标签
$content = $this->fetch($tpl);
$content = ChageATurl($content,C('Templatedir')); //修改资源文件路径
$content = str_ireplace('{field:id}',$id,$content);
$content = str_ireplace('{field:diypageurl}',U('channel/diypage','id='.$id),$content);
$content = str_ireplace('{field:dir}',$qinfo['Dir'],$content);
$content = str_ireplace('{field:ti
$content = str_ireplace('{field:keywords}',$qinfo['Keywords'],$content);
$content = str_ireplace('{field:desc
$content = str_ireplace('{tag:inside}',$qinfo['Html'],$content);
$content = qss5ucms($content); //模板标签转换
$this->show($content);
}
最佳答案
