织梦二次开发织梦dedecms增加栏目图片banner或栏
网站建设 2022-07-27 08:13www.1681989.com免费网站
图片字段lanmupic 调用图片路径 {dede:field.lanmupic/} 执行下面的sql ALTER TABLE `dede_arctype` ADD `lanmupic` VARCHAR (200) NULL 注意事项如果你只给父栏目添加了图片,而子栏目想用父栏目图片请使用下面的方法调用 复制代码 imgsrc= {dede:field.typeidrunphp=yes}$ID=@me; $sql= SELECTFROM`dede_arctype`WHEREid= $ID ; […]
图片字段lanmupic 调用图片路径
- {dede:field.lanmupic/}
执行下面的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')
- {
- $tempdex = "{style}/dex_{$nid}.htm";
- $templist = "{style}/list_{$nid}.htm";
- $temparticle = "{style}/article_{$nid}.htm";
- $queryTemplate = "sert to `dede_arctype`(reid,id,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,
- tempdex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`,`lanmupic`)
- Values('~reid~','~id~','~rank~','~typename~','~typedir~','$isdefault','$defaultname','$issend','$channeltype',
- '$tempdex','$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();
- }
- }
- $_query = "sert to `dede_arctype`(reid,id,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,
- tempdex,templist,temparticle,modname,namerule,namerule2,
- ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`,`lanmupic`)
- Values('$reid','$id','$sortrank','$typename','$typedir','$isdefault','$defaultname','$issend','$channeltype',
- '$tempdex','$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',
- tempdex='$tempdex',
- 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'
- $upsql
- where id='$id' ";
找到/dede/templets/catalog_edit.htm将下面代码插入你想要放的位置
- <tr>
- <td height="26">栏目图片</td>
- <td> <put name="lanmupic" type="text" value="<?php echo $myrow['lanmupic']?>" class="pubputs" style="width:300px" />
- <put 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> <put name="lanmupic" type="text" value="<?php echo $myrow['lanmupic']?>" class="pubputs" style="width:300px" />
- <put type="button" name="set3" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectImage('form1.lanmupic','small');" />
- </td>
- /tr>
通过以上方法可以解决二次开发织梦dedecms增加栏目图片banner或栏目图片,根据用户的需求也可以举一反三