标签调用代码
{dede:arclist row='2' titlelen='100'typeid=2 orderby='id' }
<span>
<a href="javascript:"onclick="javascript:change_tab([field:typeid/]);">[field:typename/]</a>
<!-- 上面是文章所属的主栏目,很方便调用. -->
[field:typeid2 function="get_url_by_typeid2(@me)"/]
<!-- 上面是文章所属的副栏目,需要单独写函数get_url_by_typeid2 -->
</span>
{/dede:arclist}
函数代码,在includeextend.func.php 中增加如下代码:
//得到副栏目信息,并组织字符串
function get_url_by_typeid2($typeid2){
$arrs=explode(",",$typeid2);//解析副栏目字段
if($typeid2==0){
return '';
}else{
$url='';
foreach($arrs as $v){
$url.='<a href="javascript:"
onclick="javascript:change_tab('.$v.');">'.get_typename($v).'</a>';
}
return $url;
}
}
|
//织梦根据栏目编号typeid调用typename栏目名
function get_typename($typeid){
global $dsql;
$rs=$dsql->getOne("select typename from arctype where id='$typeid'");
return $rs['typename'];
}
注意:织梦标签artlist不能调用副栏目中的文章内容的问题,即文章属于互联网这个副栏目,但互联网栏目中却不显示这个文章。需要修改系统文件./include/taglib/arclist.lib.php。
if($CrossID=='') $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).')';
else $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).','.$CrossID.')';
修改为
查看源码打印代码帮助
if($CrossID=='')
$orwheres[] = " (arc.typeid in (".GetSonIds($typeid).") or arc.typeid2 in (".GetSonIds($typeid).") or CONCAT( ',', arc.typeid2, ',' ) LIKE '%,".$typeid.",%' )";
else
$orwheres[] = " (arc.typeid in (".GetSonIds($typeid).",".$CrossID.") or arc.typeid2 in (".GetSonIds($typeid).",".$CrossID.") or CONCAT( ',', arc.typeid2, ',' ) LIKE '%,".$typeid.",%')";