搜索功能想加入網(wǎng)站url參數(shù)請(qǐng)問應(yīng)該怎么辦 剛剛問說是寫入表單隱藏域。。但是好像寫錯(cuò)了 請(qǐng)教一下
搜索框
<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>
內(nèi)容搜索
<form class="search-form">
<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>
</form>比如說https://127.0.0.1/html/xinwen.html?111 然后通過搜索按鈕后 會(huì)進(jìn)入https://127.0.0.1/news/search/keyword-關(guān)鍵詞.html?111 這個(gè)頁面 然后url參數(shù)?111 不丟失
https://127.0.0.1/news/search/keyword-關(guān)鍵詞.html?111
這個(gè)是不合法的,不能加問號(hào)
應(yīng)該這樣 https://127.0.0.1/news/search/keyword-關(guān)鍵詞-name-111.html
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)迅??蚣軇?chuàng)始人 老大~ 這個(gè)是通過百度競(jìng)價(jià)設(shè)置的URL訪問參數(shù) 我想通過我們的搜索功能這個(gè)參數(shù)不丟失~ http://127.0.0.1.com/html/jiameng.html?utm_source=sem_baidu_pc 比如通過新聞頁 新聞頁帶有?utm參數(shù) 然后通過搜索功能后搜索頁也帶有?utm參數(shù) 這樣可以實(shí)現(xiàn)嗎~ 不是帶-111這樣的 是?111這樣的
回復(fù)迅??蚣軇?chuàng)始人 是在.html后面添加的?參數(shù)~
不能加參數(shù),無解了,除非動(dòng)態(tài)模式
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
無解了!
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!