DedeCMS織夢搜索支持自增函數autoindex[織夢網站模板使用教程]
閱讀 ?·? 發布日期 2019-05-27 08:39 ?·? adminDedeCMS織夢搜索支持自增函數autoindex[織夢網站模板使用教程] [field:global.autoindex/]這個自增函數是非常常用的函數,用在不同的標簽下,產生的數組不一樣,用dedecms做網頁設計的時候根據實際需要選用。常用的有網站導航、隔行換色、TAG標簽隨機樣式、列表頁提交內容頁表單、商品列表添加多個商品到購物車等。
[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 -->
為您推薦
- 為什么企業網站優化關鍵詞慢呢網站 2020-01-09
- 百度快照優化,有簡單的方法嗎網站 2020-01-09
- 網站優化對長尾關鍵詞要怎么做網站 2020-01-09
- 量化的網站推廣服務如何實現網站建 2020-01-09
- 建設企業網站務必遵循的規則有哪些 2020-01-09