zblog php搜索页面美化和搜索结果分页
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'function' . DIRECTORY_SEPARATOR . 'searchstr.php';
#注册插件
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 = '' . $q . '';
$articles = array();
$category = new Metas;
$author = new Metas;
$tag = new Metas;
// $type = 'post-search';
$zbp->title = $zbp->lang['msg']['search'] . ' "' . $q . '"';
$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',0);
}
$pagebar=new Pagebar('{%host%}search.php?{q='.$q.'}&{page=%page%}',false);
$pagebar->PageCount=$zbp->displaycount;
$pagebar->PageNow=(int)GetVars('page','GET')==0?1:(int)GetVars('page','GET');
$pagebar->PageBarCount=$zbp->pagebarcount;
$articles = $zbp->GetArticleList(
'*',
$w,
array('log_PostTime' => 'DESC'), array(($pagebar->PageNow - 1) * $pagebar->PageCount, $pagebar->PageCount),
array('pagebar' => $pagebar),
null
);
foreach($articles as $article){
$intro = preg_replace('/[rns]+/', '', trim(SubStrStartUTF8(TransferHTML($article->Content,'[nohtml]'),$q,170)) . '...');
$article->Intro = str_ireplace($q,$qc,$intro);
$article->Title = str_ireplace($q,$qc,$article->Title);
}
$zbp->header .= '' . "rn";
$zbp->template->SetTags('title', $zbp->title);
$zbp->template->SetTags('articles',$articles);
//$zbp->template->SetTags('type',$type);
$zbp->template->SetTags('page',1);
$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;
}
© 版权声明
转载请注明来自白芸资源网以及原文地址。
本站不敢保证内容的可靠性,内容仅供小范围学习与参考,禁止用于商业、盈利或其它非法用途以及大范围传播,您需在学习与参考完毕后从您的个人存储空间彻底删除,因您滥用而造成的损失本站不承担法律责任。
本站部分内容可能源于互联网,版权争议与本站无关,如有侵权可联系站长处理,敬请谅解!
请您合法使用本站资源。
THE END