dede织梦 arclist标签完美支持currentstyle属性

由于客户需求,所以进行对文章的arclist标签进行设置当前样式(currentstyle),修改前记得备份。

dede版本v5.7sp

找到PHP修改:
include/taglib/arclist.lib.php

1、搜索:
$channelid = $ctag->GetAtt(‘channelid’);

在下面插入:
$currentstyle = $ctag->GetAtt(‘currentstyle’);

2、搜索:
$tagid,$pagesize,$isweight

修改成:
$tagid,$pagesize,$isweight,$currentstyle

3、搜索:
$innertext=”, $arcid=0, $idlist=”, $channelid=0, $limit=”, $att=”, $order=’desc’, $subday=0, $noflag=”,$tagid=”, $pagesize=0, $isweight=’N’)

修改成:
$innertext=”, $arcid=0, $idlist=”, $channelid=0, $limit=”, $att=”,$order=’desc’, $subday=0, $noflag=”,$tagid=”, $pagesize=0,$isweight=’N’,$currentstyle=”)

4、搜索:
$row[‘textlink’] = “<a href='”.$row[‘filename’].”‘>”.$row[‘title’].”</a>”;

在下面插入
if($currentstyle && $row[‘id’]==$arcid){
$currentstyle = str_replace(‘~typelink~’, $row[‘filename’], $currentstyle);
$row[‘currentstyle’] = str_replace(‘~typename~’, $row[‘title’], $currentstyle); //by adooo.org
}

保存文档上传,然后再模板添加以下代码进行调用。

调用方法:
{dede:arclist titlelen=’26’ row=’10’ currentstyle=’1′}
[field:array runphp=’yes’]
if(@me[‘currentstyle’]){
@me = “<a href='{@me[“arcurl”]}’ title='{@me[“title”]}’ class=’current’>{@me[“title”]}</a>”;
}else{
@me = “<a href='{@me[“arcurl”]}’ title='{@me[“title”]}’ class=''>{@me[“title”]}</a>”;
}
[/field:array]
{/dede:arclist}

有问题可以给我留言。

posted @ 2019-04-19 09:51  河塘月色  阅读(1087)  评论(0编辑  收藏  举报