請問搜索頁面如何定義第二個模板文件?
因為我做了中英文版本,現在中英文版本都是用同一個搜索代碼,那在英文頁面,搜索結果就會跳到中文頁面
所以想問怎么修改下面這段代碼,讓我可以使用第search_en.html的這個模板文件? 默認會使用search.html
<form class="search" action="/index.php" method="get">
<input type="hidden" name="s" value="api">
<input type="hidden" name="c" value="api">
<input type="hidden" name="m" value="search">
<input type="hidden" name="dir" id="dr_search_module_dir" >
<div class="ipt-txt">
<button id="dr_search_module_name" type="button" data-toggle="dropdown" aria-expanded="false" style="display: none"> </button>
<!-- <ul class="dropdown-menu">
這是來列出全部可以搜索的內容模塊
{php $top_search=[];}
{cache name=module-content}
{if $t.search}
{php !$top_search && $top_search=$t;}
<li><a href="javascript:dr_search_module_select('{$t.dirname}', '{$t.name}');"> {$t.name} </a></li>
{/if}
{/cache}
</ul>
-->
<input type="text" placeholder="請輸入您要搜索的關鍵詞" name="keyword" class="fc-search-keyword form-control">
</div>
<button type="submit" name="" class="btn-submit"> 搜 索 </button>
<script>
// 這段js是用來執(zhí)行搜索的
function dr_search_module_select(dir, name) {
$("#dr_search_module_dir").val(dir);
$("#dr_search_module_name").html(name+' <i class="fa fa-angle-down"></i>');
}
dr_search_module_select('{php echo defined('MOD_DIR') ? MOD_DIR : $top_search.dirname}', '{php echo defined('MOD_DIR') ? MODULE_NAME : $top_search.name}');
</script>
</form>
中英文站推薦使用多網站插件,就不會出現這個情況了
開源是一種精神,但不是義務,幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
1樓正解~多語言網站必備
如果實在不想買 多網站插件,,那就英文版單獨創(chuàng)建欄目,欄目設置中設置不一樣的模板。