DEDE5.7SP1 添加栏目图片 并且标签调用

整套修改涉及到的文件

dede/catalog_add.php
dede/catalog_edit.php
dede/templets/catalog_add.htm
dede/templets/catalog_edit.htm
include/taglib/channel.lib.php

给栏目表添加缩略图字段

alter table `dede_arctype` add `typeimg` char(100) NOT NULL default '';

 

catalog_add.php

查找

$queryTemplate = "INSERT INTO `#@__arctype`

将其后面的

(reid,topid,sortrank,typename,typedir

改成

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

将其后面的

VALUES('~reid~','~topid~','~rank~','~typename~','~typedir~'

改成

VALUES('~reid~','~topid~','~rank~','~typename~','~typedir~','~typeimg~'

(就是添加了一个字段"typeimg")

再次查找

$in_query = "INSERT INTO `#@__arctype`

(reid,topid,sortrank,typename,typedir

改成

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

将其后面的

VALUES('$reid','$topid','$sortrank','$typename','$typedir'

改成

VALUES('$reid','$topid','$sortrank','$typename','$typedir','$typeimg'

--------------------------------------------------------------------------------

catalog_edit.php

查找

$upquery = "UPDATE `#@__arctype` SET

在它的下面添加一行

typeimg='$typeimg',

--------------------------------------------------------------------------------
后台的就改到这了 然后咱们去改后台的模板

dede/templets/catalog_add.htm

在head里插入

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

然后查找

<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 height="65" style="padding-left:10px;">栏目图片:</td>
            <td>
                <input name="typeimg" type="text" style="width:250px" id="typeimg" class="alltxt" value="" />
            <input type="button" name="set9" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectImage('form1.typeimg','');" />
            </td>
          </tr>

-------------------------------------------------------------------------

dede/templets/catalog_edit.htm

在head里插入

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

然后查找

          <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 height="65" style="padding-left:10px;">栏目图片:</td>
            <td>
                <input name="typeimg" type="text" style="width:250px" id="typeimg" class="alltxt" value="<?php echo $myrow['typeimg']?>" />
            <input type="button" name="set9" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectImage('form1.typeimg','');" />
            </td>
          </tr>

-------------------------------------------------------------------
到这里可以到后台添加一个栏目图片试下了~ 看是否能添加和编辑.

然后咱们要增加调用标签

include/taglib/channel.lib.php

查找

if($type=='top')

然后分别在 TOP,son,self的查询字段里添加"typeimg"字段

$sql = "SELECT id,typename,typedir,typeimg,isdefault   ...  ...

-----------------------------------------------------------------------------

然后在标签channel里循环栏目缩略图了

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

 

 

-----------------------------------------------------------------------------

 那么想要在文章内容页显示~~~

\include\arc.archives.class.php

查找

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

修改其下面的

$query = "SELECT arc.*,tp.reid,tp.typedir,ch.addtable

改为

$query = "SELECT arc.*,tp.reid,tp.typedir,tp.typeimg,ch.addtable

就可以啦~~~~~

 

posted @ 2013-06-26 11:14  愤怒的牙签  阅读(354)  评论(0)    收藏  举报