赣州建站资讯网

为消费者提供更优质的体验

织梦增加栏目图片、缩略图功能

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/}


完毕。




- END -
声明:文字图片等素材除标明原创外均来源于网络,如有侵权,请及时告知我们,我们将在最短的时间内删除!

相关推荐

微信公众平台:圆狐创意

关注圆狐创意微信公众平台浏览最新资讯

更多媒体及商务合作

QQ:295939675   或  至电:198-6662-0460