DedeCms 栏目增加缩略图功能的方法

  • 时间:
  • 浏览:0
  • 来源:大发江苏快3_大发江苏快3投注平台_大发江苏快3娱乐平台

  此功能加进涉及到以下文件:

  dede/catalog_add.php

  dede/catalog_edit.php

  dede/templets/catalog_add.htm

  dede/templets/catalog_edit.htm

  include/taglib/channel.lib.php

  此升级修改最好的土最好的办法,在V5.7,V5.7sp1 测试通过,而且 版本未测试,原理基本相同,请你们 自行测试否有可行。

  首先给 栏目表(`#@__arctype`)增加一个 字段typeimg

alter table `#@__arctype` add `typeimg` varchar(150) NOT NULL default ;

  修改catalog_add.php文件

  打开dede/catalog_add.php

  查找$queryTemplate = “insert into `#@__arctype`

  将

(reid,topid,sortrank,typename,typedir,

  替换为:

(reid,topid,sortrank,typename,typedir,typeimg,

  将

(‘~reid~’,'~topid~’,'~rank~’,'~typename~’,'~typedir~’,

  替换为:

(‘~reid~’,'~topid~’,'~rank~’,'~typename~’,'~typedir~’,'~typeimg~’,

  查找$in_query = “INSERT INTO `#@__arctype`

  将

(reid,topid,sortrank,typename,typedir,

  替换为:

(reid,topid,sortrank,typename,typedir,typeimg,

  将

(‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,

  替换为:

(‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,'$typeimg’,

  保存catalog_add.php

  下面修改catalog_edit.php文件

  打开dede/catalog_edit.php

  查找$upquery = “Update `#@__arctype` set

  在 typedir=’$typedir’, 其下面增加一行:

`typeimg`=’$typeimg’,

  保存catalog_edit.php

  结束英文英文修改栏目加进模板文件

  打开dede/templets/catalog_add.htm

  在最上边找到这俩 段

<title>栏目管理</title>

<link href=”css/base.css” rel=”stylesheet” type=”text/css”>

  替换为:

<title>栏目管理</title>

<link href=”css/base.css” rel=”stylesheet” type=”text/css”>

<script language=”javascript” src=”../include/js/dedeajax2.js”></script>

<script language=’javascript’ src=”js/main.js”></script>

<script type=”text/javascript” src=”js/calendar/calendar.js”></script>

  列表命名规则:

<tr>

<td height="26" >列表命名规则:</td>

<td>

<input name="namerule2" type="text" id="namerule2" value="{typedir}/list_{tid}_{page}.html" class="pubinputs" />

<img src="images/help.gif" alt="帮助" width="16" height="16" border="0" onClick="ShowHide('helpvar3')"/></td>

</tr>

  在标签下面增加一行:

<!--增加栏目缩略图-->

<tr>

<td width="90" >栏目图片:</td>

<td width="5150">

<table width="1150%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td height="150">

<input name="typeimg" type="text" id="typeimg" />

<input type="button" value="本地上传" />

<iframe name='uplitpicfra' id='uplitpicfra' src='' ></iframe>

<span class="litpic_span"><input name="litpic" type="file" id="litpic" onChange="SeePicNew(this, 'divpicview', 'uplitpicfra', 165, 'archives_add.php');" size="1" class='np coolbg'/></span>

<input type="button" name="Submit2" value="取舍图片" onClick="SelectImage('form1.typeimg','small');" class='np coolbg'/>

<input type="button" name="Submit2" value="裁剪" onClick="imageCut('typeimg');" class='np coolbg'/>

<input type='checkbox' class='np' name='ddisremote' value='1' id='ddisremote'/>远程<br />(栏目模板里用{dede:field.typeimg /}调用

</td>

</tr>

</table>

</td>

<td width="1150" align="center">

<div id='divpicview' class='divpre'></div>

</td>

</tr>

<!--增加栏目缩略图-->

  保存catalog_add.htm

  结束英文英文修改栏目编辑模板文件

  打开dede/templets/catalog_edit.htm

  在最上边找到这俩 段

<title>栏目管理</title>

<link href=”css/base.css” rel=”stylesheet” type=”text/css”>

  替换为:

<title>栏目管理</title>

<link href=”css/base.css” rel=”stylesheet” type=”text/css”>

<script language=”javascript” src=”../include/js/dedeajax2.js”></script>

<script language=”javascript” src=”js/main.js”></script>

<script type=”text/javascript” src=”js/calendar/calendar.js”></script>

  查找

<tr>

<td height="26" >列表命名规则:</td>

<td> <input name="namerule2" type="text" id="namerule2" value="<?php echo $myrow['namerule2']?>" size="40" class="iptxt" />

<img src="images/help.gif" alt="帮助" width="16" height="16" border="0" onClick="ShowHide('helpvar3')"/></td>

</tr>

  在其下面增加一行:

<!--增加栏目缩略图-->

<tr>

<td width="90" height="81" >栏目图片:</td></td>

<td width="1150">

<input name="typeimg" type="text" id="typeimg" value="<?php echo $myrow['typeimg']?>"><input type="button" name="Submit" value="浏览..." onClick="SelectImage('form1.typeimg','');">

<input type="button" name="Submit2" value="裁剪" onClick="imageCut('typeimg');" class='np coolbg'/>

<input type='checkbox' class='np' name='ddisremote' value='1'>

远程<br />(栏目模板里用{dede:field.typeimg /}调用)

</td>

<td align="center">

<img src="<?php if($myrow['typeimg']!="") echo $myrow['typeimg']; else echo "images/pview.gif";?>" width="1150" height="1150" id="picview" name="picview">

</td>

</tr>

<!--增加栏目缩略图-->

  保存catalog_edit.htm

  至此但是修改完成!

  栏目图片的加进或修改图片时在 (栏目管理>高级选项)上边就会自动突然总出 栏目图片加进的取舍,点击取舍图片,弹出窗口内取舍浏览上传就OK

  注意:前台栏目标签调用的但是,还时需改一个 文件,并能实现栏目图片显示,而且可不还能不能了通过sql说说并能显示图片。

  打开:include/taglib/channel.lib.php

  找到

if($type=='top')

{

$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

From `#@__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 `#@__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 `#@__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 `#@__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 `#@__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 `#@__arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row";

}

  调用最好的土最好的办法:

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

  最近有越来越多 前网友见面见面问到修改的最好的土最好的办法,现在我把但是修改好的后台文件分享出来,下载下来直接覆盖到后台就可不时需了。http://115.com/file/anqwqyi0

  但是想同去在文章内容页调用栏目图片打开,修改\include\arc.archives.class.php

  查找

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);

  替换为: 

$query = “Select arc.*,tp.reid,tp.typedir,tp.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’ “;

$this->Fields = $this->dsql->GetOne($query);

  保存文件即可。

  原文地址:http://www.xueleilei.com/internet/423.html