首页 >

织梦DedeCMS会员中心空间中,spacenewart标签功能的拓展

在dede的博客空间中,spacenewart标签只能调用频道的内容,不能调用特定栏目的文章,不能调用附加表字段,功能有限。

织梦DedeCMS会员中心空间中,spacenewart标签功能的拓展

现修改spacenewart标签的文件include\tpllib\plus_spacenewart.php

以实现如下功能:可以调用特定栏目的文章,可以调用附加表的字段。

include\tpllib\plus_spacenewart.php 修改后的代码如下:

GetOne("SELECT addtable FROM `dede_channeltype` WHERE id='$channel' ");        if(isset($row2['addtable']) && trim($row2['addtable']) != '')        {            $addtable = trim($row2['addtable']);            $addfields = explode(',', $addfield);            $row2['addtable'] = trim($row2['addtable']);            $addfieldsSql = ",addf.".join(',addf.', $addfields);            $addfieldsSqlJoin = " LEFT JOIN `$addtable` addf ON addf.aid = arc.id ";        }    }    $query = "Select arc.*,mt.mtypename,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,        tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath $addfieldsSql        from `dede_archives` arc        left join `dede_arctype` tp on arc.typeid=tp.id        left join `dede_mtypes` mt on mt.mtypeid=arc.mtype $addfieldsSqlJoin        where arc.mid='{$_vars['mid']}' and arc.channel=$channel and arc.ismake='1' and arc.typeid in ($typeid)        order by id desc limit 0,$row";    //echo $query;    $dsql->SetQuery($query);    $dsql->Execute("al");    $artlist = '';    $rearr = array(); $i=1;    while($row = $dsql->GetArray("al"))    {        //处理一些特殊字段  $row['i']=$i;  $i=$i+1;        $row['infos'] = cn_substr($row['description'],$infolen);        $row['id'] =  $row['id'];        $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],        $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);        $row['typeurl'] = GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],        $row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']);        if($row['litpic']=='')        {            $row['litpic'] = '/images/defaultpic.jpg';        }        if(!preg_match("#^http:\/\/#i", $row['litpic']))        {            $row['picname'] = $row['litpic'] = $GLOBALS['cfg_cmsurl'].$row['litpic'];        }        else        {            $row['picname'] = $row['litpic'] = $row['litpic'];        }        $row['stime'] = GetDateMK($row['pubdate']);        $row['typelink'] = "https://www.liuzhongwei.com/a/dedejq/".$row['typename']."";        $row['image'] = "".preg_replace("#[";        $row['imglink'] = "https://www.liuzhongwei.com/a/dedejq/".$row['image']."";        $row['fulltitle'] = $row['title'];        $row['title'] = cn_substr($row['title'],$titlelen);        if($row['color']!='') {            $row['title'] = "https://www.liuzhongwei.com/a/dedejq/".$row['title']."";        }        if(preg_match('#b#', $row['flag']))        {            $row['title'] = "https://www.liuzhongwei.com/a/dedejq/".$row['title']."";        }        //$row['title'] = "https://www.liuzhongwei.com/a/dedejq/".$row['title']."";        $row['textlink'] = "https://www.liuzhongwei.com/a/dedejq/".$row['title']."";        $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];        $row['memberurl'] = $GLOBALS['cfg_memberurl'];        $row['templeturl'] = $GLOBALS['cfg_templeturl'];          //$row['fengge'] = $row['fengge'];          $rearr[] = $row;    }//loop line    $dsql->FreeResult("al");    return $rearr;}


功能拓展后的spacenewart标签使用示例如下:

{dede:spacenewart row=1 titlelen=60  typeid='29' channel='18' addfields='name,shengshi,nianling' }
姓名:{dede:field.name/}
籍贯:{dede:field.shengshi/}
年龄:{dede:field.nianling/}

{/dede:spacenewart}

其中name,shengshi,nianling字段为附加表字段,typeid=’29’指定栏目,channel=’18’指定频道。


织梦DedeCMS会员中心空间中,spacenewart标签功能的拓展
  • 织梦DedeCMS火车头采集文章列表地址列表错误URL没有协议头是//搞定方式
  • 织梦DedeCMS火车头采集文章列表地址列表错误URL没有协议头是//搞定方式 | 织梦DedeCMS火车头采集文章列表地址列表错误URL没有协议头是//搞定方式 ...

    织梦DedeCMS会员中心空间中,spacenewart标签功能的拓展
  • 织梦DedeCMS怎么在注册会员页面增加一个字段
  • 织梦DedeCMS怎么在注册会员页面增加一个字段 | 织梦DedeCMS怎么在注册会员页面增加一个字段 ...

    织梦DedeCMS会员中心空间中,spacenewart标签功能的拓展
  • 解决织梦DedeCMS 5.7 三级目录、侧导航的调用
  • 解决织梦DedeCMS 5.7 三级目录、侧导航的调用 | 解决织梦DedeCMS 5.7 三级目录、侧导航的调用 ...

    © 牛的日记 | www.liuzhongwei.com
    网站部分内容来源于网友供稿,若有侵权请联系删除,970928#QQ.com