本节中以增加上传图片为例 ,
注意:增加新的字段,除了一下设置外,还用更改标签中的允许调用的字段
再用{dede:type}调用栏目字段时,会有限制,需要修改include/taglib/type.lib.php文件中增加相应的字段
第一步:在数据库中创建一个字段:如typeimg
第二步:打开dede/catlog_add.php
1)在inser into 语句增加typeimg对应的字段 有两处
2)打开dede/templates/catalog_add.htm,增加如下代码:
<script language="javascript" src="../include/js/dedeajax2.js"></script>
<script language='javascript' src="js/main.js"></script>
<!--增加栏目缩略图-->
<tr>
<td width="90" style="padding-left:10px;">栏目图片:</td>
<td width="560">
<table width="100%" border="0" cellspacing="1"
cellpadding="1">
<tr>
<td height="30">
<input name="typeimg" type="text" id="typeimg" style="width:240px"
/>
<input type="button" value="本地上传"
style="width:70px;cursor:pointer;display:none" />
<iframe name='uplitpicfra' id='uplitpicfra' src=''
style='display:none'></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="选择图片"
style="margin-left:8px;" onClick="SelectImage('form1.typeimg','small');"
class='np coolbg'/>
<input type="button" name="Submit2" value="裁剪"
style="margin-left:8px;" 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="150" align="center">
<div id='divpicview' class='divpre'></div>
</td>
</tr>
<!--增加栏目缩略图-->
第三步:打开catalog_edit.php
在38,137行后添加:typeimg='$typeimg',
第四步:打开catalog_edit.htm
<script language="javascript" src="../include/js/dedeajax2.js"></script>
<script language="javascript" src="js/main.js"></script>
<!--增加栏目缩略图-->
<tr>
<td width="90" height="81"
style="padding-left:10px;">栏目图片:</td></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','');">
<input type="button" name="Submit2" value="裁剪"
style="margin-left:8px;" 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="150" height="100"
id="picview" name="picview">
</td>
</tr>
<!--增加栏目缩略图-->