VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
华纳云最新优惠促销活动
jtti最新优惠促销活动

如何在织梦cms中增加栏目图片

locvps
主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情!
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作

如何在织梦cms中增加栏目图片

本课程的运行环境:Windows10系统,DEDEDECMS版,Dell G3电脑。

Dreamweaver cms如何添加列图片?

在dedecms (Dreaming CMS)后台添加柱形图的编码方法

第一步,首先我们把要添加的图片字段命名为typeimg。您可以在后台添加代码并执行代码,如下所示:“System-& gt;Sql命令工具",插入SQL语句Alter Table dede _ ArcType Add type img Varchar(100)。第二步:进入后台管理文件目录(默认:Dede目录),在“catelog_add.php”下找几个地方修改。1.找到$queryTemplate(大约65行)。我修改的代码如下:

$ queryTemplate = & quotINSERT INTO `#@__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,` cross `, ` content `, ` small types,` typeimg `)值(& # 39;~ reid ~ & # 39,'~ topid ~ & # 39,'~排名~ & # 39;,'~键入名称~ & # 39;,'~ typedir ~ & # 39,'$ isdefault & # 39,'$ defaultname & # 39,'$ issend & # 39,'$ channeltype & # 39, '$ tempindex & # 39,'$ templist & # 39,'$ temparticle & # 39,'默认& # 39;,'$ namerule & # 39,'$ namerule2 & # 39,'0','0','','','~键入名称~ & # 39;,'0','','','0','0','0','','','~ typeimg ~ & # 39)& quot;2.Find $ in _ query(大约227行)

修改整个$in_query

$ in _ query = & quotINSERT INTO `#@__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,` cross `, ` content `, ` small types,` typeimg `)值(& # 39;$里德& # 39;,'$ topid & # 39,'$ sortrank & # 39,'$ typename & # 39,'$ typedir & # 39,'$ isdefault & # 39,'$ defaultname & # 39,'$ issend & # 39,'$ channeltype & # 39, '$ tempindex & # 39,'$ templist & # 39,'$ temparticle & # 39,'默认& # 39;,'$ namerule & # 39,'$ namerule2 & # 39, '$ ispart & # 39,'$ corank & # 39,'$ description & # 39,'$ keywords & # 39,'$ seotitle & # 39,'$ moresite & # 39,'$ siteurl & # 39,'$ sitepath & # 39,'$ ishidden & # 39,'$ cross & # 39,'$ crossid & # 39,'$ content & # 39,'$ smalltypes & # 39,'$ typeimg & # 39)& quot;其实也没什么难的。新手可以复制粘贴,老手可以自己修改,就是在语句中增加一个typeimg字段。第三步:同样的方法,在“catelog_edit.php”下找到$ upquery(大约38行),修改代码如下。

$ upquery = & quot更新`# @ _ _ arctype` SET issend = & # 39$ issend & # 39,sortrank = & # 39$ sortrank & # 39,typename = & # 39$ typename & # 39,类型目录= & # 39;$ typedir & # 39,isdefault = & # 39$ isdefault & # 39,defaultname = & # 39$ defaultname & # 39,issend = & # 39$ issend & # 39,ishidden = & # 39$ ishidden & # 39,channeltype = & # 39$ channeltype & # 39,tempindex = & # 39$ tempindex & # 39,templist = & # 39$ templist & # 39,temparticle = & # 39$ temparticle & # 39,namerule = & # 39$ namerule & # 39,namerule2 = & # 39$ namerule2 & # 39,ispart = & # 39$ ispart & # 39,corank = & # 39$ corank & # 39,描述= & # 39;$ description & # 39,关键词= & # 39;$ keywords & # 39,seotitle = & # 39$ seotitle & # 39,moresite = & # 39$ moresite & # 39,` cross` = & # 39$ cross & # 39,` content` = & # 39$ content & # 39,` crossid` = & # 39$ crossid & # 39,` typeimg` = & # 39$ typeimg & # 39,` smalltypes` = & # 39$ smalltypes & # 39$uptopsql,其中id = & # 39$ id & # 39";第四步:在后台管理文件目录(默认:dede目录)/templates/ File下输入“catalog_add.htm和catalog _ edit.htm”,在之间添加以下代码:

& lt脚本语言= & # 39;javascript & # 39src = & quotjs/main . js & quot;& gt& lt/script & gt;将以下代码添加到catalog_add.htm中

& lt!-加入专栏-& gt;& lttr & gt& lttd class = & quotbline & quotheight = & quot26 & quotstyle = & quot左填充:10px"& gt列图片:</TD & gt;& lttd class = & quotbline & quot& gt& lt输入类型= & quot文本& quotname = & quot键入& quotid = & quotimgmm & quotstyle = & quot宽度:300px & quotclass = & quot文本& quot/& gt;& lt输入名称= & quotimgmm _ bt & quottype = & quot按钮& quotclass = & quot输入但& quotvalue = & quot浏览..." onclick = & quot选择图像(& # 39;form 1 . img mm & # 39;,'大& # 39;)& quot/& gt;& lt/TD & gt;& lt输入类型= & quot隐藏& quotname = & quotdede _ addonfields & quotvalue = & quotimgmm,img & quot/& gt;& lt/tr & gt;将以下代码添加到catalog_edit.htm中

& lt!-加入专栏-& gt;& lttr & gt& lttd class = & quotbline & quotheight = & quot26 & quotstyle = & quot左填充:10px"& gt列图片:</TD & gt;& lttd class = & quotbline & quot& gt& lt输入类型= & quot文本& quotname = & quot键入& quotid = & quotimgmm & quotstyle = & quot宽度:300px & quotclass = & quot文本& quotvalue = & quot& lt?PHP echo $ myrow[& # 39;typeimg & # 39]?& gt"/& gt;& lt输入名称= & quotimgmm _ bt & quottype = & quot按钮& quotclass = & quot输入但& quotvalue = & quot浏览..." onclick = & quot选择图像(& # 39;form 1 . img mm & # 39;,'大& # 39;)& quot/& gt;& lt/TD & gt;& lt输入类型= & quot隐藏& quotname = & quotdede _ addonfields & quotvalue = & quotimgmm,img & quot/& gt;& lt/tr & gt;注意:这两个文件的编码不同,要分开添加。

第五步:如果使用全通通道标签调用列,那么应该更改文件/include/taglib/channel . lib . PHP,并找到下面的代码替换它。

if($ type = = & # 39;top & # 39){ $ sql = & quotSELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typeimg From `#@__arctype `其中reid=0,ishidden & lt& gt1 order by sortrank asc limit 0,$ line & quot;} else if($type = = & # 39;子& # 39;){ if($ typeid = = 0)return & # 39;';$ sql = & quotSELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typeimg From `#@__arctype `其中reid = & # 39$ typeid & # 39而ishidden & lt& gt1 order by sortrank asc limit 0,$ line & quot;} else if($type = = & # 39;self & # 39){ if($ Reid = = 0)return & # 39;';$ sql = & quotSELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typeimg FROM `#@__arctype `其中reid = & # 39$里德& # 39;而ishidden & lt& gt1 order by sortrank asc limit 0,$ line & quot;}实际上,typeimg字段是添加到sql语句中的。第六步,打电话到前台。

{dede:频道类型= & # 39;self & # 39typeid = & # 3915'row = & # 398'currentstyle = & quot& lt李& gt& lta href = & # 39~ typelink ~ & # 39class = & # 39thisclass & # 39& gt~键入名称~ & lt/a & gt;& lt/李& gt"} & lt李& gt& lta href = & # 39[field:typelink/]& # 39;& gt[field:typename/]& lt;/a & gt;& ltimg src = & # 39[field:type img/]& # 39;/& gt;& lt/李& gt{/dede:channel}以上代码在线。那不是我想要的。如果我得到当前列的顶部图片。

我用两种方法来解决这个问题:我有效地测试了它。第一个:修改文件include/helpers/extend。helper.php找到gettoptype函数,并在其中添加以下代码,以获得列图片。

//添加列图片$ top type img = $ row[& # 39;typeimg & # 39];if($ action = & quot;图像& quot)返回$ toptypeimg前台调用方法:

& ltimg src = & quot{ dede:field . typeid function = gettoptype(@ me,images)/} & quot;& gt所以你可以打电话。完美!!

第二种方法:修改文件include/common.func.php,只需在末尾添加一个函数,如下:

//获取最上面一列的列图片。李国平在2021年3月11日更新了它。函数gettoptypeimg($ ID){ global $ dsql;$ row = $ dsql-& gt;GetOne(& quot;SELECT typeimg,topid FROM dede_arctype其中id = $ id & quot);if($row[& # 39;topid & # 39] == '0'){ return $ row[& # 39;typeimg & # 39];} else { $ row 1 = $ dsql-& gt;GetOne(& quot;从dede_arctype中选择typeimg,其中id = $ row[topid]& quot;);return $ row 1[& # 39;typeimg & # 39];}}前台调用方法为:

& ltimg src = & quot{dede:字段名= & # 39;typeid & # 39函数= & quotGetTopTypeimg(@ me)& quot;/} & quot;& gt这也可以叫做。完美!!

推荐学习:dedecms教程

以上是造梦cms如何增加栏目图片的细节。更多信息请关注主机参考其他相关文章!

这几篇文章你可能也喜欢:

本文由主机参考刊发,转载请注明:如何在织梦cms中增加栏目图片 https://zhujicankao.com/91441.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » 如何在织梦cms中增加栏目图片
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

评论 抢沙发

评论前必须登录!