dedecms v5.7如何在后台栏目中添加缩略图

时间:2011-10-17 10:45 来源:GOODIDEA100.COM 点击:点击这里给我发消息

30元香港免备案空间

以下内容是我在网上找的 ,感觉稍微有点乱,在原文的基础上改了改更方便理解。
 

1.新加字段 typeimg。
后台执行SQL: alter table `dede_arctype` add `typeimg` char(100) NOT NULL default '';



2.打开dede/catalog_add.php
查找$queryTemplate = "insert into `dede_arctype`
(reid,topid,sortrank,typename,typedir,
替换为
(reid,topid,sortrank,typename,typedir,typeimg,

('~reid~','~topid~','~rank~','~typename~','~typedir~',
替换为
('~reid~','~topid~','~rank~','~typename~','~typedir~','~typeimg~',


3.打开dede/catalog_edit.php
查找
$upquery = "Update `dede_arctype` set
 
在其下面新加一行
`typeimg`='$typeimg',


4.打开dede/templets/catalog_add.htm
查找
          <tr>            <td height="26">列表命名规则:</td>            <td>              <input name="namerule2" type="text" id="namerule2" value="{typedir}/list_{tid}_{page}.html"  class="pubinputs"  style="width:250px" />              <img src="img/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="SelectTemplets('SelectImage('form1.typeimg','small');" />                (栏目模板里用{dede:field.typeimg /}调用)            </td>          </tr>


5.打开dede/templets/catalog_edit.htm
查找
          <tr>             <td height="26">列表命名规则:</td>            <td> <input name="namerule2" type="text" id="namerule2" value="<?php echo $myrow['namerule2']?>" size="40" class="iptxt" />               <img src="img/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','small');" />
                (栏目模板里用{dede:field.typeimg /}调用)            </td>          </tr>

注意上面两步需要在网页中head部分添加
<script language="javascript" src="../include/js/dedeajax2.js"></script>
<script language='javascript' src="js/main.js"></script>

 

至此 本功能已经完成完成!



如果想同时在文章内容页调用打开\include \arc.archives.class.php
查找
if($this->ChannelUnit->ChannelInfos['issystem']!=-1)

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

from `dede_archives` arc                        

left join dede_arctype tp on tp.id=arc.typeid                         

left join dede_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 `dede_archives` arc                        

left join dede_arctype tp on tp.id=arc.typeid                         

left join dede_channeltype as ch on arc.channel = ch.id                         

where arc.id='$aid' ";               

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


 


相关文档

  • dedecms v5.7如何在后台栏目中添加缩
  • dedecms 后台增加复制文章功能
  • DedeCMS自动截取标题长度加省略号
  • phpcms v9 调用数据列表如何在标题
  • 使用channelartlist和itemindex制作狗铺
  • dedecms5.6后台验证码不显示、错误
  • dede5.6后台发布文章空白的解决办

套图收藏

MORE>>