dedecms二次开发:在织梦首页、列表页和内容页上调用文章的副栏目名称

2015-05-14 00:02 阅读 105 次 评论关闭

如何在织梦dedecms首页、列表页内容页调用文章副栏目名称?具体方法如下:

在内容页的标签
            {dede:field.typeid2 runphp='yes'}
                 $dsql= new dedesql();
                 $ks = split(',', @me);
                 $type2name="";
                 foreach($ks as $k){
                     $k = trim($k);   
                     if ($k!="") {
                          if ($row = $dsql->getOne("select *,ID as id1 from #@__arctype where id=".$k)){
                                 $type_path=GetTypeUrl($row['id1'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
                                  $type2name.="<a href='".$type_path."'  target=_blank>".$row['typename']."</a> ";   
                          }           
                     }    
                 }
                @me=substr($type2name,0,strlen($type2name)-1);
            {/dede:field.typeid2}

首页、列表页标签(在arclist、list等文章列表标签里用):

            [field:typeid2  runphp='yes']
                 $dsql= new dedesql();
                 $ks = split(',', @me);
                 $type2name="";
                 foreach($ks as $k){
                     $k = trim($k);   
                     if ($k!="") {
                          if ($row = $dsql->getOne("select *,ID as id1 from #@__arctype where id=".$k)){
                                 $type_path=GetTypeUrl($row['id1'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
                                  $type2name.="<a href='".$type_path."'  target=_blank>".$row['typename']."</a> ";   
                          }           
                     }    
                 }
                @me=substr($type2name,0,strlen($type2name)-1);
            [/field:typeid2]

[/post]

版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:dedecms二次开发:在织梦首页、列表页和内容页上调用文章的副栏目名称 | 猎微网

评论已关闭!