当前位置:首页站长学院DEDECMSdedecms专题模板怎么用
企业营销,就选知企PROSAAS

dedecms专题模板怎么用

dedecms专题模板怎么用

dedecms专题模板怎么用?

DeDeCms的专题相关信息bbs上相对较少,之前查阅了很多资料都未找到其解决方案

  

推荐学习:织梦cms

无柰只有靠自己动手丰衣足食;在官方的版本上有这样的一段话: 

1、文章列表用ID1,ID2,ID3这样形式分开,系统会自动排除不同节点的相同文章;

2、关于单条记录模板里的[field:fieldname /]标记的使用,请参考关于系统帮助关于 arclist 标记的说明;

3、节点ID是节点的唯一标识,允许在专题模板中用{dede:specnote id=’标识’/}这样来表示单个节点。

4、正常的情况下,每个节点显示的是“节点文章列表”里的文档,如果你指定为“自动获取模式”,那么必须指定关键字和栏目ID。

可是经测试{dede:specnote id=’标识’/}这个并没有升效;因此开始解决这个,以替换掉原来比较死板{dede:field name=’note’/}标签;

举例说明:

我要分两栏显示不同节点的文章,目前用”note”就不能实现,只能是同一节点分栏,难免就显得有些捌扭,不够灵活。

下面我就把自己解决方案写下供同学们参考,首先得申明一点,只能是实现了功能,可算法不一定是最好的,因为我不太熟悉DEDECMS代码且没有认真的研究过,希望大家海涵!

步骤1:

文件位置:{include/inc_archives_view.php} 

代码如下:

//广告标记
//-----------------------
else if($ctag->GetName()=="myad"){
$this->dtp->Assign($tagid,$this->PartView->GetMyAd($typeid,$ctag->GetAtt("name")));
}
// 专题标识
// by phpfans
else if($ctag->GetName()=="specnote"){
$this->dtp->Assign($tagid,$this->ChannelUnit->GetSpecList('',$this->ChannelUnit->specrule,$ctag->GetAtt("id")));
}

  介绍:{在广告标记下增加专题标识}这样专题文章列表页就可以识别specnote标签了

步骤2:

文件位置:{include/inc_channel_unit.php}

var $specrule;
//-------------
//php5构造函数
//-------------

介绍:增加了对$pecrule变量的定义

步骤3:

文件位置:{include/inc_channel_unit.php}

代码如下:

else if($ftype=="specialtopic"){
$this->specrule = $fvalue;
$fvalue = $this->GetSpecList($fname,$fvalue); 
}

   介绍:这儿增加了$this->specrule = $fvalue;这句,以便获取addonspec表的note字段数据;

步骤4:

  文件位置:{include/inc_channel_unit.php}

代码如下:

//获得专题文章的列表
//--------------------------------
function GetSpecList($fname,$noteinfo,$noteid="")
{
if(!isset($GLOBALS['__SpGetArcList'])) require_once(dirname(__FILE__)."/inc/inc_fun_SpGetArcList.php");
if($noteinfo=="") return "";
$rvalue = "";
$tempStr = GetSysTemplets("channel/channel_spec_note.htm");
$dtp = new DedeTagParse(); </p> <p></p> <p>$dtp->LoadSource($noteinfo);
if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $k=>$ctag){
$notename = $ctag->GetAtt("name");
if($noteid!="" && $ctag->GetAtt("noteid")!=$noteid){ continue; } //指定名称的专题节点
if($noteid!="" && $ctag->GetAtt("noteid")===$noteid) {
$isauto = $ctag->GetAtt("isauto");
$idlist = trim($ctag->GetAtt("idlist"));
$rownum = trim($ctag->GetAtt("rownum"));
if(empty($rownum)) $rownum = 40;
$keywords = "";
$stypeid = 0;</p> <p>if($isauto==1){
$idlist = "";
$keywords = trim($ctag->GetAtt("keywords"));
$stypeid = $ctag->GetAtt("typeid");
}</p> <p>if(trim($ctag->GetInnerText())!="") $listTemplet = $ctag->GetInnerText();
else $listTemplet = GetSysTemplets("spec_arclist.htm");
$idvalue = SpGetArcList($this->dsql,
$stypeid,$rownum,$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight"),
"all","default",$keywords,$listTemplet,100,0,$idlist);</p> <p>$notestr = str_replace("~notename~",$notename,$tempStr);
$notestr = str_replace("~spec_arclist~",$idvalue,$notestr);
$rvalue .= $notestr;
if($noteid!="" && $ctag->GetAtt("noteid")==$noteid){ break; }
}
}
}
$dtp->Clear();
return $rvalue;
}

介绍:有些小改动,自己对比一下就清楚了,这儿就不再哆嗦了

步骤5:

说明: 原{dede:field name=’note’/}标签失效了,如果要用的朋友请自行修改步骤四部份。。

很简单的;

完工!

以上就是dedecms专题模板怎么用的详细内容,更多请关注知企PROSAAS其它相关文章!

温馨提示:

文章标题:dedecms专题模板怎么用

文章链接:https://ceshi.prosaas.cn/1201.html

更新时间:2020年01月13日

声明: 本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:973664285@qq.com我们将第一时间处理! 资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。 所有资源仅限于参考和学习,版权归原作者所有,更多请阅读知企PROSAAS协议

给TA打赏
共{{data.count}}人
人已打赏
DEDECMS

织梦dedecms怎么整合添加ckplayer播放器支持flv,mp4等播放功能

2020-1-13 9:34:24

DEDECMS

dedecms联动类别怎么用

2020-1-13 9:43:19

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索