帝国CMS副页面如何实现一篇文章多个动态内容页

信息页:调用一个模板,展示一条帝国cms的信息;副页面:调用另外一个模板,展示同一条帝国cms的信息。

第一步:复制文件

将 e/action/ShowInfo.php 文件复制一份,并重命名,比如命名为 MoreInfo.php

第二步:修改文件

打开刚才复制并重命名的文件,并进行修改

(1)找到 //moreport 和 //缓存,大约在35行至46行之间,这之间的几行代码删除

也就是如下代码删除:

//moreport
if(Moreport_ReturnMustDt())
{
	$class_r[$classid]['showdt']=2;
}
//是否支持动态内容页
if($class_r[$classid]['showdt']!=2)
{
	$titleurl=sys_ReturnBqTitleLink($r);
	Header("Location:$titleurl");
	exit();
}

 

(2)查找 $newstemp_r= ,在其上一行插入代码:

if($_GET['newstempid']){
	$r['newstempid']=$_GET['newstempid'];
}

也就是,修改后的代码变成了:

//取得内容模板
$r[newstempid]=$r[newstempid]?$r[newstempid]:$class_r[$r[classid]][newstempid];
if($_GET['newstempid']){
	$r['newstempid']=$_GET['newstempid'];
}
$newstemp_r=$empire->fetch1("select tempid,temptext,showdate from ".GetTemptb("enewsnewstemp")." where tempid='$r[newstempid]'");

第三步:使用方法

访问地址是/e/action/MoreInfo.php?classid=栏目id&id=信息id&newstempid=此页的内容模板id

可以看到,访问地址与自带的动态内容模板类似,但要多一个newstempid参数,方便指定不同模板

注意事项

这个页面不支持正文分页,如需分页还需要另行修改。

不能使用系统自带的缓存功能,否则会跟自带动态页面混淆。

THE END