Zblog php search page beautification and search results pagination

Zblog plug-in two thousand nine hundred and seventy-five

The search result page of zblog php calls a single page, which cannot be customized or paginated. It is ugly and inhumane. The Search Plus plug-in can optimize the search results page, support the call of index template and reserved search template (provided that the subject has one), support the highlighting of search terms, and most importantly, the list can be customized.

 Zblog php search page beautification and search results pagination

Plug in installation:

Search Search Plus in the Application Center to install it directly.

Modify plug-in:

1. By default, this plug-in only optimizes the search interface, but it cannot be paginated. You need to modify this plug-in to paginate search results;

2. Edit the include.php file under zb_users/plugin/SearchPlus/, find about 40 lines of the plug-in, and change the query statement to:

 one two three four five six seven eight nine ten eleven twelve
 $pagebar = new Pagebar ( '{%host%}search.php? {q=' . $q . '}&{page=%page%}' , false ) ;
 $pagebar -> PageCount = $zbp -> displaycount ; 
 $pagebar -> PageNow = ( int ) GetVars ( 'page' , 'GET' ) == zero ? one : ( int ) GetVars ( 'page' , 'GET' ) ;
 $pagebar -> PageBarCount = $zbp -> pagebarcount ;   $articles  =  $zbp -> GetArticleList (
         '*' , 
         $w ,
         array ( 'log_PostTime'  =>  'DESC' ) ,  array ( ( $pagebar -> PageNow  -  one )  *  $pagebar -> PageCount ,  $pagebar -> PageCount ) ,
         array ( 'pagebar'  =>  $pagebar ) ,
         null
     ) ;

Find about 70 lines of the plug-in and change them to:

 one
 $zbp -> template -> SetTags ( 'pagebar' , $pagebar ) ;

If you are too lazy to find code, you can directly cover all the codes in the include.php file with the following code:

 one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four twenty-five twenty-six twenty-seven twenty-eight twenty-nine thirty thirty-one thirty-two thirty-three thirty-four thirty-five thirty-six thirty-seven thirty-eight thirty-nine forty forty-one forty-two forty-three forty-four forty-five forty-six forty-seven forty-eight forty-nine fifty fifty-one fifty-two fifty-three fifty-four fifty-five fifty-six fifty-seven fifty-eight fifty-nine sixty sixty-one sixty-two sixty-three sixty-four sixty-five sixty-six sixty-seven sixty-eight sixty-nine seventy seventy-one seventy-two seventy-three seventy-four seventy-five seventy-six seventy-seven seventy-eight seventy-nine eighty eighty-one eighty-two eighty-three eighty-four eighty-five eighty-six eighty-seven eighty-eight eighty-nine ninety ninety-one ninety-two ninety-three ninety-four ninety-five ninety-six ninety-seven ninety-eight ninety-nine one hundred one hundred and one
 <? php
 require  dirname ( __FILE__ )  .  DIRECTORY_SEPARATOR  .  'function'  .  DIRECTORY_SEPARATOR  .  'searchstr.php' ;
 #Register plug-in RegisterPlugin ( "SearchPlus" , "ActivePlugin_SearchPlus" ) ;   function ActivePlugin_SearchPlus ( )  { Add_Filter_Plugin ( 'Filter_Plugin_Search_Begin' , 'SearchPlus_Main' ) ;   }   function SearchPlus_Main ( )  {
     global  $zbp ;   foreach  ( $GLOBALS [ 'Filter_Plugin_ViewSearch_Begin' ]  as  $fpname  =>  & $fpsignal )  {
         $fpreturn  =  $fpname ( ) ;
         if  ( $fpsignal  == PLUGIN_EXITSIGNAL_RETURN )  {
             $fpsignal = PLUGIN_EXITSIGNAL_NONE ; return  $fpreturn ;
         }
     }   if ( ! $zbp -> CheckRights ( $GLOBALS [ 'action' ] ) ) { Redirect ( './' ) ; }   $q  =  trim ( htmlspecialchars ( GetVars ( 'q' , 'GET' ) ) ) ;
     $qc  =  '<b style=\'color:red\'>'  .  $q  .  '</b>' ;   $articles  =  array ( ) ;
     $category  =  new Metas ;
     $author  =  new Metas ;
     $tag  =  new Metas ;   //    $type = 'post-search';   $zbp -> title  =  $zbp -> lang [ 'msg' ] [ 'search' ]  .  ' &quot;'  .  $q  .  '&quot;' ;   $template  =  $zbp -> option [ 'ZC_INDEX_DEFAULT_TEMPLATE' ] ;   if ( isset ( $zbp -> templates [ 'search' ] ) ) {
         $template  =  'search' ;
     }   $w = array ( ) ;
     $w [ ] = array ( '=' , 'log_Type' , '0' ) ;
     if ( $q ) {
         $w [ ] = array ( 'search' , 'log_Content' , 'log_Intro' , 'log_Title' , $q ) ;
     } else { Redirect ( './' ) ;
     }   if ( ! ( $zbp -> CheckRights ( 'ArticleAll' ) && $zbp -> CheckRights ( 'PageAll' ) ) ) {
         $w [ ] = array ( '=' , 'log_Status' , zero ) ;
     }   $pagebar = new Pagebar ( '{%host%}search.php? {q=' . $q . '}&{page=%page%}' , false ) ;
 $pagebar -> PageCount = $zbp -> displaycount ; 
 $pagebar -> PageNow = ( int ) GetVars ( 'page' , 'GET' ) == zero ? one : ( int ) GetVars ( 'page' , 'GET' ) ;
 $pagebar -> PageBarCount = $zbp -> pagebarcount ;   $articles  =  $zbp -> GetArticleList (
         '*' , 
         $w ,
         array ( 'log_PostTime'  =>  'DESC' ) ,  array ( ( $pagebar -> PageNow  -  one )  *  $pagebar -> PageCount ,  $pagebar -> PageCount ) ,
         array ( 'pagebar'  =>  $pagebar ) ,
         null
     ) ;
     foreach ( $articles  as  $article ) {
         $intro  =  preg_replace ( '/[\r\n\s]+/' ,  '' ,  trim ( SubStrStartUTF8 ( TransferHTML ( $article -> Content , '[nohtml]' ) , $q , one hundred and seventy ) )  .  '...' ) ;
         $article -> Intro  =  str_ireplace ( $q , $qc , $intro ) ;
         $article -> Title  =  str_ireplace ( $q , $qc , $article -> Title ) ;
     }   $zbp -> header  .=  '<meta name="robots" content="noindex,follow" />'  .  " \r \n " ;
     $zbp -> template -> SetTags ( 'title' ,  $zbp -> title ) ;
     $zbp -> template -> SetTags ( 'articles' , $articles ) ;
     //$zbp->template->SetTags('type',$type);
     $zbp -> template -> SetTags ( 'page' , one ) ;
     $zbp -> template -> SetTags ( 'pagebar' , $pagebar ) ;   if  ( isset ( $zbp -> templates [ 'search' ] ) )  {
         $zbp -> template -> SetTemplate ( $template ) ;
     }  else  {
         $zbp -> template -> SetTemplate ( 'index' ) ;
     }   foreach  ( $GLOBALS [ 'Filter_Plugin_ViewList_Template' ]  as  $fpname  =>  & $fpsignal )  {
         $fpreturn = $fpname ( $zbp -> template ) ;
     }   $zbp -> template -> Display ( ) ; RunTime ( ) ;
     die ( ) ;
 }   function InstallPlugin_SearchPlus ( )  {
     global  $zbp ;   }   function UninstallPlugin_SearchPlus ( )  {
     global  $zbp ;   }

Modified code from Bird Blog

Highlight: