找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1305|回复: 0

[分享] dede织梦让channelartlist标签支持currentstyle属性

[复制链接]
发表于 2018-3-16 14:42:11 | 显示全部楼层 |阅读模式 来自 河南省新乡市
1.查找到:
  1. $channelid = $ctag->GetAtt('channelid');
复制代码


在下面插入:
  1. $currentstyle = $ctag->GetAtt('currentstyle');
复制代码

2、查找:
  1. return lib_arclistDone
  2.            (
  3.              $refObj, $ctag, $typeid, $ctag->GetAtt('row'), $ctag->GetAtt('col'), $titlelen, $infolen,
  4.              $ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), $listtype, $orderby,
  5.              $ctag->GetAtt('keyword'), $innertext, $envs['aid'], $ctag->GetAtt('idlist'), $channelid,
  6.              $ctag->GetAtt('limit'), $flag,$ctag->GetAtt('orderway'), $ctag->GetAtt('subday'), $ctag->GetAtt('noflag'),
  7.              $tagid,$pagesize,$isweight
  8.            );
复制代码


替换为:
  1. return lib_arclistDone
  2.            (
  3.              $refObj, $ctag, $typeid, $ctag->GetAtt('row'), $ctag->GetAtt('col'), $titlelen, $infolen,
  4.              $ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), $listtype, $orderby,
  5.              $ctag->GetAtt('keyword'), $innertext, $envs['aid'], $ctag->GetAtt('idlist'), $channelid,
  6.              $ctag->GetAtt('limit'), $flag,$ctag->GetAtt('orderway'), $ctag->GetAtt('subday'), $ctag->GetAtt('noflag'),
  7.              $tagid,$pagesize,$isweight,$currentstyle
  8.            );
复制代码

其实就是在调用函数的最后加了一个$currentstyle实参
3、查找
  1. function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen=30, $infolen=160,
  2.         $imgwidth=120, $imgheight=90, $listtype='all', $orderby='default', $keyword='',
  3.         $innertext='', $arcid=0, $idlist='', $channelid=0, $limit='', $att='', $order='desc', $subday=0, $noflag='',$tagid='', $pagesize=0, $isweight='N')
复制代码

替换为:
  1. function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen=30, $infolen=160,
  2.         $imgwidth=120, $imgheight=90, $listtype='all', $orderby='default', $keyword='',
  3.        $innertext='', $arcid=0, $idlist='', $channelid=0, $limit='', $att='',$order='desc', $subday=0, $noflag='',$tagid='', $pagesize=0,$isweight='N',$currentstyle='')
复制代码

其实就是在函数后面加了一个$currentstyle=''形参
4、查找
  1. $row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
复制代码

在下面插入:
  1. if($currentstyle && $row['id']==$arcid){
  2.                     $currentstyle = str_replace('~typelink~', $row['filename'], $currentstyle);
  3.                     $row['currentstyle'] = str_replace('~typename~', $row['title'], $currentstyle);
  4.                 }
复制代码

保存,即可。
调用方法:
  1. {dede:arclist titlelen='42' row='10' currentstyle="<li class='current' ><a href='~typelink~'>~typename~</a></li>"}
  2.      [field:array runphp='yes']
  3.          if(@me['currentstyle']){
  4.              @me = @me['currentstyle'];
  5.          }else{
  6.              @me = "<li class='current' ><a href='{@me['arcurl']}'>{@me['title']}</a></li>";
  7.          }
  8.      [/field:array]
  9. {/dede:arclist}
复制代码

也可以与channelartlist标签相结合使用,
这样调用:
  1. {dede:channelartlist typeid='2' currentstyle='current'}
  2. <dt ><a class='{dede:field.currentstyle/}' href='{dede:field name='typeurl'/}'>{dede:field name='typename'/}</a></dt>
  3. {dede:arclist titlelen='42' row='10' currentstyle="<dd><a class='current' href='~typelink~'>~typename~</a></dd>"}
  4.      [field:array runphp='yes']
  5.          if(@me['currentstyle']){
  6.              @me = @me['currentstyle'];
  7.          }else{
  8.              @me = "<dd ><a href='{@me['arcurl']}'>{@me['title']}</a></dd>";
  9.          }
  10.      [/field:array]
  11. {/dede:arclist}
  12. {/dede:channelartlist}
复制代码

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则 需要先绑定手机号

关闭

站长推荐上一条 /1 下一条

QQ|侵权投诉|广告报价|手机版|小黑屋|西部数码代理|飘仙建站论坛 ( 豫ICP备2022021143号-1 )

GMT+8, 2024-5-9 03:49 , Processed in 0.039251 second(s), 9 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表