<td align="center"><img src=http://www.dede58.com/"<?php if($myrow['typeimg']!="") echo $myrow['typeimg']; else echo "images/pview.gif";?>" width="150" height="100" id="picview" name="picview"></td>
</tr>
保存此文件!
到这里已经基本修改完成!
栏目图片的添加或修改图片时在 (栏目管理>高级选项)里面就会自动出现栏目图片添加的选择,点击选择图片,弹出窗口内选择浏览上传就OK。
注意:前台栏目标签调用的时候,还需要改一个文件,才能实现栏目图片显示,否则只能通过sql语句才能显示图片。
第三步:缩略图调用
打开:include/taglib/channel.lib.php
查找
if($type=='top')
将
if($type=='top')
{
$sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
From `arctype` WHERE reid=0 And ishidden<>1 order by sortrank asc limit 0, $line ";
}
else if($type=='son')
{
if($typeid==0) return '';
$sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
From `arctype` WHERE reid='$typeid' And ishidden<>1 order by sortrank asc limit 0, $line ";
}
else if($type=='self')
{
if($reid==0) return '';
$sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";
}
替换为
if($type=='top')
{
$sql = "SELECT id,typename,typedir,typeimg,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
From `arctype` WHERE reid=0 And ishidden<>1 order by sortrank asc limit 0, $line ";
}
else if($type=='son')
{
if($typeid==0) return '';
$sql = "SELECT id,typename,typedir,typeimg,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
From `arctype` WHERE reid='$typeid' And ishidden<>1 order by sortrank asc limit 0, $line ";
}
else if($type=='self')
{
if($reid==0) return '';
$sql = "SELECT id,typename,typedir,typeimg,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";
}
导航栏目调用方法:
<img src=http://www.dede58.com/”[field:typeimg/]” />
第四步:文章内容页调用
如果想同时在文章内容页调用栏目图片打开,修改\include\arc.archives.class.php
查找
if($this->ChannelUnit->ChannelInfos['issystem']!=-1)
将
if($this->ChannelUnit->ChannelInfos['issystem']!=-1)
{
// 如果当前文档不是系统模型,为单表模型
$query = "SELECT arc.*,tp.reid,tp.typedir,ch.addtable
FROM `archives` arc
LEFT JOIN arctype tp on tp.id=arc.typeid
LEFT JOIN channeltype as ch on arc.channel = ch.id
WHERE arc.id='$aid' ";
$this->Fields = $this->dsql->GetOne($query);
替换为
if($this->ChannelUnit->ChannelInfos['issystem']!=-1)
{
// 如果当前文档不是系统模型,为单表模型
$query = "SELECT arc.*,tp.reid,tp.typedir,typeimg,ch.addtable
FROM `archives` arc
LEFT JOIN arctype tp on tp.id=arc.typeid
LEFT JOIN channeltype as ch on arc.channel = ch.id
WHERE arc.id='$aid' ";