图片字段:lanmupic 调用图片路径: {dede:field.lanmupic/} 执行下面的sql: ALTER TABLE `dede_arctype` ADD `lanmupic` VARCHAR (200) NULL 注意事项:如果你只给父栏目添加了图片,而子栏目想用父栏目图片请使用下面的方法调用: 复制代码 imgsrc= {dede:field.typeidrunphp=yes}$ID=@me; $sql= SELECT*FROM`dede_arctype`WHEREid= $ID ; […]
执行下面的sql:
-
ALTER TABLE `dede_arctype` ADD `lanmupic` VARCHAR( 200 ) NULL
注意事项:如果你只给父栏目添加了图片,而子栏目想用父栏目图片请使用下面的方法调用:
复制代码
-
<img src="{dede:field.typeid runphp='yes'}$ID = @me;
-
$sql = "SELECT * FROM `dede_arctype` WHERE id=$ID";
-
$query = mysql_query($sql);
-
$row=mysql_fetch_array($query);
-
$relID = "$row[reid]"; if($relID == 0) {@me = $row[lanmupic];}else{$sql = "SELECT `lanmupic` FROM `dede_arctype` WHERE id=$relID";
-
$query = mysql_query($sql);$row=mysql_fetch_array($query); @me = $row[lanmupic];}{/dede:field.typeid}"/>
找到:/dede/catalog_add.php第63行
-
else if($dopost=='savequick')
-
{
-
$tempindex = "{style}/index_{$nid}.htm";
-
$templist = "{style}/list_{$nid}.htm";
-
$temparticle = "{style}/article_{$nid}.htm";
-
$queryTemplate = "insert into `dede_arctype`(reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,
-
tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`,`lanmupic`)
-
Values('~reid~','~topid~','~rank~','~typename~','~typedir~','$isdefault','$defaultname','$issend','$channeltype',
-
'$tempindex','$templist','$temparticle','default','$namerule','$namerule2','0','0','','','~typename~','0','','','0','0','0','','','$lanmupic')";
第176行
-
-
if($ispart != 2)
-
{
-
$true_typedir = str_replace("{cmspath}",$cfg_cmspath,$typedir);
-
$true_typedir = ereg_replace("/{1,}","/",$true_typedir);
-
if(!CreateDir($true_typedir))
-
{
-
ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!","-1");
-
exit();
-
}
-
}
-
-
-
$in_query = "insert into `dede_arctype`(reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,
-
tempindex,templist,temparticle,modname,namerule,namerule2,
-
ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`,`lanmupic`)
-
Values('$reid','$topid','$sortrank','$typename','$typedir','$isdefault','$defaultname','$issend','$channeltype',
-
'$tempindex','$templist','$temparticle','default','$namerule','$namerule2',
-
'$ispart','$corank','$description','$keywords','$seotitle','$moresite','$siteurl','$sitepath','$ishidden','$cross','$crossid','$content','$smalltypes','$lanmupic')";
找到:/dede/catalog_edit.php第38行
-
$upquery = "Update `dede_arctype` set
-
issend='$issend',
-
sortrank='$sortrank',
-
typename='$typename',
-
typedir='$typedir',
-
isdefault='$isdefault',
-
defaultname='$defaultname',
-
issend='$issend',
-
ishidden='$ishidden',
-
channeltype='$channeltype',
-
tempindex='$tempindex',
-
templist='$templist',
-
temparticle='$temparticle',
-
namerule='$namerule',
-
namerule2='$namerule2',
-
ispart='$ispart',
-
corank='$corank',
-
description='$description',
-
keywords='$keywords',
-
seotitle='$seotitle',
-
moresite='$moresite',
-
`cross`='$cross',
-
`content`='$content',
-
`crossid`='$crossid',
-
`smalltypes`='$smalltypes',
-
`lanmupic`='$lanmupic'
-
$uptopsql
-
where id='$id' ";
找到/dede/templets/catalog_edit.htm将下面代码插入你想要放的位置
-
<tr>
-
<td height="26">栏目图片:</td>
-
<td> <input name="lanmupic" type="text" value="<?php echo $myrow['lanmupic']?>" class="pubinputs" style="width:300px" />
-
<input type="button" name="set3" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectImage('form1.lanmupic','small');" />
-
</td>
-
/tr>
找到/dede/templets/catalog_add.htm将下面代码插入你想要放的位置
-
<tr>
-
<td height="26">栏目图片:</td>
-
<td> <input name="lanmupic" type="text" value="<?php echo $myrow['lanmupic']?>" class="pubinputs" style="width:300px" />
-
<input type="button" name="set3" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectImage('form1.lanmupic','small');" />
-
</td>
-
/tr>
通过以上方法可以解决二次开发织梦dedecms增加栏目图片banner或栏目图片,根据用户的需求也可以举一反三