欢迎来到素材无忧网,按 + 收藏我们
登录 注册 退出 找回密码

织梦增加栏目图片、缩略图功能在栏目高级选项下

时间: 2019-04-21 19:32 阅读: 作者:素材无忧网

网站每个栏目都有不同的banner大图,为了方便客户可以直接在后台栏目处添加和更换这个栏目图片,我们需要给dedecms二次开发,增加栏目图片上传选项。

织梦栏目添加banner大图上传选项

织梦增加栏目图片、缩略图功能最新无BUG教程


1.先给数据库中的dede_arctype表增加一个字段

后台 - 系统 - 系统设置 - SQL命令行工具

ALTER TABLE `dede_arctype` ADD `typeimg` CHAR( 255 ) NOT NULL DEFAULT '';


2.打开 \dede\templets\catalog_add.htm 搜索

<tr>
            <td height="26" style="padding-left:10px;">列表命名规则:</td>
            <td>
              <input name="namerule2" type="text" id="namerule2" value="{typedir}/list_{tid}_{page}.html"  class="pubinputs"  style="width:250px" />
              <img src="images/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar3')"/></td>
          </tr>

在下方增加:

<!--增加栏目图-->
<tr>
<td width="90" height="81" style="padding-left:10px;"><font color='red'>栏目图片2:</font></td>
<td width="500">
  <input name="typeimg" type="text" id="typeimg" style="width:300px" value=""><input type="button" name="Submit" value="浏览..." style="width:70px" onClick="SelectImage('form1.typeimg','');">
  远程<br />(栏目模板里用{dede:field.typeimg /}调用)
  </td>
<td align="center">
<img src="<?php echo "images/pview.gif";?>" width="150" height="100" id="picview" name="picview">
</td>
</tr>
<!--增加栏目图-->

3.打开 \dede\templets\catalog_edit.htm 搜索

 <tr> 
            <td height="26" style="padding-left:10px;">列表命名规则:</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" style="cursor:pointer" onClick="ShowHide('helpvar3')"/></td>
          </tr>

在下方增加:

<!--增加栏目图-->
<tr>
<td width="90" height="81" style="padding-left:10px;"><font color='red'>栏目图片2:</font></td>
<td width="500">
  <input name="typeimg" type="text" id="typeimg" style="width:300px" value="<?php echo $myrow['typeimg']?>"><input type="button" name="Submit" value="浏览..." style="width:70px" onClick="SelectImage('form1.typeimg','');">
  远程<br />(栏目模板里用{dede:field.typeimg /}调用)
  </td>
<td align="center">
<img src="<?php if($myrow['typeimg']!="") echo $myrow['typeimg']; else echo "images/pview.gif";?>" width="150" height="100" id="picview" name="picview">
</td>
</tr>
<!--增加栏目图-->


4.打开 \dede\catalog_add.php 搜索

$queryTemplate = "INSERT INTO

在下面一行

`dede_arctype`(reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,

改为

`dede_arctype`(reid,topid,sortrank,typename,typedir,typeimg,isdefault,defaultname,issend,channeltype,

红色是新增


继续搜索

VALUES('~reid~','~topid~','~rank~','~typename~','~typedir~','$isdefault','$defaultname','$issend','

改为

VALUES('~reid~','~topid~','~rank~','~typename~','~typedir~','~typeimg~','$isdefault','$defaultname','$issend','


5.打开 \dede\catalog_edit.php 搜索

typedir='$typedir',

只需修改42行的,下面那一行不需要修改

替换为

typedir='$typedir',

typeimg='$typeimg',


6.打开 \include\taglib\channelartlist.lib.php 搜索

typedir

改成

typedir,typeimg

7.打开 \include\taglib\channel.lib.php 搜索

typedir

改成

typedir,typeimg

注意:这个文件有4处都需要改

8.打开 \include\taglib\type.lib.php 搜索

typedir

改成

typedir,typeimg

9.\include\arc.listview.class.php 搜索

//设置环境变量

在它下面添加

$this->Fields['typeimg'] = $this->TypeLink->TypeInfos['typeimg'];


前台模板中调用标签

{dede:channelartlist}{dede:field.typeimg/}{/dede:channelartlist}

{dede:channel}[field:typeimg/]{/dede:channel}

{dede:type}[field:typeimg/]{/dede:type}

栏目列表页单独调用

{dede:field.typeimg/}

版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!

转载请注明: 织梦增加栏目图片、缩略图功能在栏目高级选项下

标签:  
相关文章
模板推荐