0 Comments

爬行的蜗牛dede(织梦)55讲-给栏目增加缩略图2

发布于:2016-07-14  |   作者:爬行的蜗牛  |   已聚集:人围观

爬行的蜗牛昨天已经写了《给栏目增加缩略图》,但是还不够,那样只能用万能标签sql来调用,我们还要修改下达到用标签调用的效果:

步骤如下:

 

  1:找到include/taglib/channel.lib.php这个文件,打开后找到

if($type=='top') { $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description  From `dede_arctype` where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="son") { //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid']; if($typeid==0) { return ''; } $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description  From `dede_arctype` where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="self") { if($reid==0) { return ''; } $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description  From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row"; }


  替换成下面的:

if($type=='top') { $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description  From `dede_arctype` where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="son") { //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid']; if($typeid==0) { return ''; } $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description  From `dede_arctype` where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="self") { if($reid==0) { return ''; } $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description  From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row"; }



 

这样我们就可以调用了,调用方法如下:

<img src=”[field:typeimg /]” />


 

    如果想同时在文章内容页调用栏目图片打开,找到\include\arc.archives.class.php文件查找

 if($this->ChannelUnit->ChannelInfos['issystem']!=-1)


 

  将

$query = “Select arc.*,tp.reid,tp.typedir,ch.addtable
from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id=$aid’ “; $this->Fields = $this->dsql->GetOne($query);



 

  替换为: 

$query = “Select arc.*,tp.reid,tp.typedir,tp.typeimg,ch.addtable
from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id=$aid’ “; $this->Fields = $this->dsql->GetOne($query);


这样就可以了,小伙伴们快去试试效果吧。

希望能帮助到大家,爬行的蜗牛:http://www.pxwoniu.com/dede/153.html

飞机

扫描二维码,访问爬行的蜗牛手机网站

在线咨询