本次修改是基于ECMS(帝国cms) EmpireCMS v7.0 Free (201301151518)版本下测试修改的。其他未测试,大同小异吧。可以根据修改做修改即可 一、打开\e\search\index.php 411行左右,找到: 1 Header( Locat
本次修改是基于ECMS(帝国CMS) EmpireCMS v7.0 Free (201301151518)版本下测试修改的。其他未测试,大同小异吧。可以根据修改做修改即可
一、打开\e\search\index.php 411行左右,找到:
1 |
Header( "Location:result/?searchid=$searchid" . $dogetvar );
|
修改为:
1 |
Header( "Location:$public_r[newsurl]search-0-$searchid.html" . $dogetvar );
|
二、打开\e\search\result\index.php 20行左右,找到:
1 2 |
//搜索结果
$searchid =(int) $_GET [ 'searchid' ];
|
在前面添加分页函数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
//增加分页函数
function page10( $num , $line , $page_line , $start , $page , $search ){
global $fun_r ;
if ( $num <= $line )
{
return '' ;
}
$search =RepPostStr( $search ,1);
$url = $public_r [ 'newsurl' ]. 'search' ;
$snum =2; //最小页数
$totalpage = ceil ( $num / $line ); //取得总页数
$firststr = '<a style="border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; border: 0px !important; float: none !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; min-height: inherit !important; ">. $fun_r [ 'trecord' ]. '"> ' . $num . ' </a> ' ;
//上一页
if ( $page <>0)
{
$toppage = '<a href="' . $url . '-0-' . $search . '.html">' . $fun_r [ 'startpage' ]. '</a> ' ;
$pagepr = $page -1;
$prepage = '<a href="' . $url . '-' . $pagepr . '-' . $search . '.html">' . $fun_r [ 'pripage' ]. '</a>' ;
}
//下一页
if ( $page != $totalpage -1)
{
$pagenex = $page +1;
$nextpage = ' <a href="' . $url . '-' . $pagenex . '-' . $search . '.html">' . $fun_r [ 'nextpage' ]. '</a>' ;
$lastpage = ' <a href="' . $url . '-' .( $totalpage -1). '-' . $search . '.html">' . $fun_r [ 'lastpage' ]. '</a>' ;
}
$starti = $page - $snum <0?0: $page - $snum ;
$no =0;
for ( $i = $starti ; $i < $totalpage && $no < $page_line ; $i ++)
{
$no ++;
if ( $page == $i )
{
$is_1 = "<b>" ;
$is_2 = "</b>" ;
}
else
{
$is_1 = '<a href="' . $url . '-' . $i . '-' . $search . '.html">' ;
$is_2 = "</a>" ;
}
$pagenum = $i +1;
$returnstr .= " " . $is_1 . $pagenum . $is_2 ;
}
$returnstr = $firststr . $toppage . $prepage . $returnstr . $nextpage . $lastpage ;
return $returnstr ;
}
|
然后在48行左右找到:
1 |
$listpage =page1( $num , $line , $page_line , $start , $page , $search );
|
修改为:
1 |
$listpage =page10( $num , $line , $page_line , $start , $page , $search );
|
再找到
1 |
$search = "&searchid=" . $searchid ;
|
修改为:
1 |
$search = "$searchid" ;
|
三、添加伪静态规则(例子为Apache,自己修改为对应的)
搜索
1 |
RewriteRule ^search-(.+?)-(.+?)\.html$ /e/search/result/index\.php\?page= $1 &searchid= $2
|
四、修改搜索模板中的提交地址为绝对地址:
比如:
1 |
<form action= 'http://www.16css.com/e/search/index.php' method= "post" name= "search_news" id= "search_news" >
|
提示:不建议使用相对地址。
转载请说明出处
知优网 » ECMS(帝国CMS)搜索伪静态教程(帝国cms筛选伪静态)
知优网 » ECMS(帝国CMS)搜索伪静态教程(帝国cms筛选伪静态)