欢迎来到258分享网,纯净的网络源码分享基地!

258资源分享网

全部作品
全部作品
网站源码
微信源码
素材特效
源码插件
视频教程
建站学院
热门搜索: 织梦  农业种植  农业  安全设置  官方
258资源分享 > 建站学院 > 织梦教程 > DedeCMS织梦搜索支持自增函数autoindex

推荐下载

HTML5响应式自适应网咯设计

2020-05-12   浏览:740

高端HTML5响应式企业通用网

2020-05-06   浏览:521

html5响应式外贸网站英文版

2020-05-08   浏览:510

HTML5自适应律师工作室类网

2020-04-04   浏览:504

HTML5影视传媒文化公司类网

2020-05-12   浏览:500

DedeCMS织梦搜索支持自增函数autoindex

发布时间:2020-02-22  

[field:global.autoindex/]这个自增函数是非常常用的函数,用在不同的标签下,产生的数组不一样,用dedecms做网页设计的时候根据实际需要选用。常用的有网站导航、隔行换色、TAG标签随机样式、列表页提交内容页表单、商品列表添加多个商品到购物车等。

dede搜索调用自定义字段自增[field:global.autoindex/]

[field:global.autoindex/]在不同标签下产生数组 arclist 标签下使用 [field:global.autoindex/] 默认从1开始 channel 标签下使用 [field:global.autoindex/] 默认从0开始 channelartlist 标签下使用 {dede:global.itemindex/} 默认从1开始 arclist 从0开始[field:global name=autoindex runphp="yes"]@me=@me-1;[/field:global] channel 从1开始[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global][field:typename/] channelartlist 从0开始{dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global} channelartlist 标签下使用 {dede:global name='itemindex' runphp='yes'}@me;{/dede:global}  

dedecms的搜索页面不支持自增函数[field:global.autoindex/],这可蛋疼了,自己研究了一下分享给站长们。

打开/include/arc.searchview.class/php,在顶部找到

require_once(DEDEINC."/taglib/hotwords.lib.php");  

在下面添加

require_once(DEDEINC."/taglib/arclist.lib.php");  

找到

else if($tagname=="hotwords") { $this->dtp->Assign($tagid,lib_hotwords($ctag,$this)); }  

在下面添加

else if($tagname=="arclist") { $this->dtp->Assign($tagid,lib_arclist($ctag,$this)); }  

这样就能让搜索页支持{dede:arclist}{/dede:arclist}标签,就能解决[field:global.autoindex/]失效的问题,{dede:arclist}标签很灵活,能用在列表或者首页、在列表页相当于{dede:list},也支持分页,但是自定义字段需要动一下手。

搜索页面调用自定义字段前台HTML源代码 {dede:arclist row='20' addfields='自定义字段' channelid='该字段所在的频道模型ID'} <p class="p_[field:global.autoindex/]">[field:title/]</p> {/dede:arclist}  

dede搜索页另外一种增加自定义字段的方法参考文章《dedecms搜索功能增加自定义字段》。

搜索页面支持单独栏目搜索功能HTML源代码 <p class="search"> <form name="formsearch" action="{dede:global.cfg_cmsurl/}/plus/search.php"> <input type="hidden" name="kwtype" value="0" /> <select name="searchtype" class="search-option" id="search-option"> <option value="title" selected='1'>All</option> {dede:channelartlist typeid='2' } {dede:type} <option value='[field:id/]'>[field:typename/]</option>{/dede:type} {dede:channel type='son' noself='yes'} <option value='[field:id/]'>-[field:typename/]</option> {/dede:channel} {/dede:channelartlist} </select> <input name="q" type="text" class="search-keyword" id="search-keyword" value="Part Cord..." onfocus="if(this.value=='Part Cord...'){this.value='';}" onblur="if(this.value==''){this.value='Part Cord...';}" /> <button type="submit" class="search-submit"></button> </form> </p><!-- //search -->