聯(lián)系官方銷售客服
1835022288
028-61286886
大佬們 我用的search自帶的代碼 發(fā)現(xiàn)搜索的時(shí)候url有問題
url會(huì)帶catid-6- 想問一下怎么去掉這個(gè)
用內(nèi)容搜索框的話是可以u(píng)rl不帶欄目的
<div class="input-group"> <input type="text" class="form-control" placeholder="搜索內(nèi)容..." name="keyword" value='{$keyword}' id='search_keyword' onkeypress="if(event.keyCode==13) {dr_module_search('search_keyword');return false;}"> <div class="input-group-btn"> <button class="btn default" type="button" onclick="dr_module_search('search_keyword')"> <i class="glyphicon glyphicon-search"></i></button> </div> </div> <script> // 這段js是用來執(zhí)行搜索的 function dr_module_search(name) { var url="{Router::search_url($params, 'keyword', 'dayruicom')}"; var value = $("#"+name).val(); if (value) { location.href=url.replace('dayruicom', value); } else { $("#"+name).focus() dr_tips(0, "輸入關(guān)鍵字"); } return false; } </script>
內(nèi)容搜索框 用這個(gè)可以u(píng)rl不帶欄目 但是無法實(shí)現(xiàn)輸入為空則顯示輸入關(guān)鍵詞
<form class="search-form" action="/index.php" method="get"> <input type="hidden" name="s" value="news"> <input type="hidden" name="c" value="search"> <div class="input-group"> <input type="text" class="form-control" placeholder="搜索內(nèi)容..." name="keyword"> <div class="input-group-btn"> <button class="btn default" type="submit"> <i class="glyphicon glyphicon-search"></i></button> </div> </div> </form>
想實(shí)現(xiàn)的目標(biāo) 用搜索 如果沒有輸入搜索內(nèi)容則顯示輸入關(guān)鍵詞(自帶模塊已實(shí)現(xiàn)) 如果搜索的話url不帶欄目名稱(內(nèi)容搜索框已經(jīng)實(shí)現(xiàn)) 我想結(jié)合一下這兩種 請(qǐng)問應(yīng)該怎么做
加一句就可以去掉