织梦dedecms使用dede:arclist按照自定义字段的条件调用

,dedecms织梦dede:arclist按照自定义字段的条件调用相关文章,这对于想要在首页调用某个自定义字段的文章的同学来讲,非常不错  ,打开 /include/taglib/arclist.lib.php 找到:
 ,//关键字条件 在它的上面加入  ,//自定义字段关键字条件 ,if($ctag->GetAtt('addk')!='') {  ,$addkeywords = explode(',' , trim($ctag->GetAtt('addk')));  ,$addf = $ctag->GetAtt('addf') ? $ctag->GetAtt('addf') : "body";  ,$filtersql = '';  ,$n = 1;  ,foreach($addkeywords as $k)   ,{    ,if(trim($k)=='') continue;    ,else $k = addslashes($k);   ,$filtersql .= ($filtersql=='' ? " find_in_set('$k', addf.$addf) " : " OR find_in_set('$k', addf.$addf) ");  ,$n++;   ,}  , ,$orwheres[] = $filtersql; } , ,模板调用标签写法 :
 ,{dede:arclist typeid='1' row='10' channelid='1' addfields='jiage,dengji,shangdao,canyin' addk='奢华6星' addf='dengji'} <li>  ,<a href="[field:arcurl/]">  ,<img src="[field:litpic/]" width="143" border="0" height="106">  ,<span class="title">[field:title/]</span><br/>  ,<small>岛屿等级:[field:dengji/]</small>  ,</a> </li> {/dede:arclist} , ,channelid='1' //你的模型id号  ,addfields='jiage,dengji,shangdao,canyin' //你的自定义字段  ,addk='奢华6星' //要调用的自定义字段值  ,addf='dengji' //要调用的自定义字段
返回顶部
跳到底部

Copyright 2011-2024 南京追名网络科技有限公司 苏ICP备2023031119号-6 乌徒帮 All Rights Reserved Powered by Z-BlogPHP Theme By open开发

请先 登录 再评论,若不是会员请先 注册