之前介紹過織夢手機站搜索與PC站搜索結果一樣的解決方法,后來測試發現此方法僅支持織夢默認移動程序。
下面介紹織夢手機站搜索與PC同步的方法:
1、找到/plus/search.php文件,復制一份重命名為search_m.php,這里隨意命名都行。
2、找到/include/arc.searchview.class.php文件,復制一份重命名為arc.searchview.class_m.php,這里文件名也可隨意。
3、打開新的search_m.php文件,找到:
require_once(DEDEINC."/arc.searchview.class.php");
改成:
require_once(DEDEINC."/arc.searchview.class_m.php");
4、在新的arc.searchview.class_m.php文件中找打
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/search.htm";
改成:
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/search_m.htm";
5、在搜索模板找到相應代碼按如下所示更改:
<form action="{dede:global.cfg_cmsurl/}/plus/search_m.php" name="formsearch"> <input type="hidden" name="kwtype" value="0"/> <input type="hidden" name="mobile" value="1" /> <input type="text" name="q" class="txt fl" placeholder="想看什么?輸入名稱試試..."> <input type="submit" name="button" class="btn fr"></form>注意:搜索模板名稱要改成“search_m.htm”,search_m.php是PC目錄下的文件,另外css、js、images路徑需要更改。
以上操作完成,如有搜索結果頁面的分頁無法使用自帶標簽控制,可以按如下方法修改:
在新的arc.searchview.class_m.php文件中大概856行找打找到:
//獲得上一頁和下一頁的鏈接if($this->PageNo != 1)
這里可以去掉td標簽修改成自己想要的樣式。
繼續找到876行一直到906行左右:
//獲得數字鏈接$listdd="";$total_list = $list_len * 2 + 1; if($this->PageNo >= $total_list) { $j = $this->PageNo - $list_len; $total_list = $this->PageNo + $list_len; if($total_list > $totalpage) { $total_list = $totalpage; } } else { $j=1; if($total_list > $totalpage) { $total_list = $totalpage; } } for($j; $j<=$total_list; $j++) { if($j == $this->PageNo) { $listdd.= "<td>$j </td>/r/n"; } else { $listdd.="<td><a href='".$purl."PageNo=$j'>[".$j."]</a> </td>/r/n"; } }這一段代碼全部注釋或者刪掉。
繼續找到916到920行直接的代碼并注釋或者刪掉。
if($totalpage>$total_list){ $plist.="<td width='38'><input type='text' name='PageNo' style='width:28px;height:14px' value='".$this->PageNo."' /></td>/r/n"; $plist.="<td width='30'><input type='submit' name='plistgo' value='GO' style='width:30px;height:22px;font-size:9pt' /></td>/r/n";}至此,全部完成。
新聞熱點
疑難解答