📄 inc_arcsearch_view.php
字号:
$this->dsql->SetQuery($insert);
$this->dsql->executenonequery();
$this->result = $aids;
$this->TotalResult = $nums;
$this->cacheid = $this->dsql->GetLastID();
}
}else{
$cachequery = $this->dsql->getone("select * from #@__search_cache where cacheid=".$this->cacheid." limit 1");
if(is_array($cachequery)){
$nums = $cachequery['nums'];
$result = $cachequery['result'];
$this->dsql->setquery($update);
$this->dsql->executenonequery();
$this->result = $result;
$this->TotalResult = $nums;
}else
{
ShowMsg("系统出错,请与管理员联系!","javascript:;");
$this->Close();
exit();
}
}
}
//------------------
//显示列表
//------------------
function Display()
{
foreach($this->dtp->CTags as $tagid=>$ctag){
$tagname = $ctag->GetName();
if($tagname=="list"){
$limitstart = ($this->PageNo-1) * $this->PageSize;
$row = $this->PageSize;
if(trim($ctag->GetInnerText())==""){ $InnerText = GetSysTemplets("list_fulllist.htm"); }
else{ $InnerText = trim($ctag->GetInnerText()); }
$this->dtp->Assign($tagid,
$this->GetArcList($limitstart,
$row,
$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),
$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),
$ctag->GetAtt("imgheight"),
$this->ChannelType,
$this->OrderBy,
$InnerText,
$ctag->GetAtt("tablewidth"))
);
}
else if($tagname=="pagelist"){
$list_len = trim($ctag->GetAtt("listsize"));
if($list_len=="") $list_len = 3;
$this->dtp->Assign($tagid,$this->GetPageListDM($list_len));
}
else if($tagname=="likewords"){
$this->dtp->Assign($tagid,$this->GetLikeWords($ctag->GetAtt('num')));
}
else if($tagname=="hotwords"){
$this->dtp->Assign($tagid,
GetHotKeywords($this->dsql,$ctag->GetAtt('num'),$ctag->GetAtt('subday'),$ctag->GetAtt('maxlength')));
}
else if($tagname=="field") //类别的指定字段
{
if(isset($this->Fields[$ctag->GetAtt('name')]))
$this->dtp->Assign($tagid,$this->Fields[$ctag->GetAtt('name')]);
else
$this->dtp->Assign($tagid,"");
}
else if($tagname=="channel")//下级频道列表
{
if($this->TypeID>0){
$typeid = $this->TypeID; $reid = $this->TypeLink->TypeInfos['reID'];
}
else{ $typeid = 0; $reid=0; }
$this->dtp->Assign($tagid,
$this->TypeLink->GetChannelList($typeid,
$reid,
$ctag->GetAtt("row"),
$ctag->GetAtt("type"),
$ctag->GetInnerText()
)
);
}//End if
}
$this->Close();
$this->dtp->Display();
}
//----------------------------------
//获得文档列表
//---------------------------------
function GetArcList($limitstart=0,$perpage=10,$col=1,$titlelen=30,$infolen=250,
$imgwidth=120,$imgheight=90,$achanneltype="all",$orderby=" aid desc ",$innertext="",$tablewidth="100")
{
$typeid=$this->TypeID;
if($perpage=="") $perpage = 10;
if($limitstart=="") $limitstart = 0;
if($titlelen=="") $titlelen = 30;
if($infolen=="") $infolen = 250;
if($achanneltype=="") $achanneltype = "0";
$innertext = trim($innertext);
if($innertext=="") $innertext = GetSysTemplets("search_list.htm");
$ordersql = "order by ".$this->OrderBy;
$query = "select * from #@__full_search left join #@__arctype on #@__arctype.ID=#@__full_search.typeid
where aid in ($this->result) $ordersql limit $limitstart,$perpage ";
$this->dsql->SetQuery($query);
$this->dsql->Execute("al");
$artlist = "";
$this->dtp2->LoadSource($innertext);
$tt = 0;
for($i=0;$i<$perpage;$i++)
{
if($row = $this->dsql->GetArray("al"))
{
//处理一些特殊字段
$row["arcurl"] = $row["url"];
$row["description"] = $this->GetRedKeyWord(cn_substr($row["addinfos"],$infolen));
$row["title"] = $this->GetRedKeyWord(cn_substr($row["title"],$titlelen));
$row["id"] = $row["aid"];
if($row["litpic"]=="") $row["litpic"] = $GLOBALS["cfg_plus_dir"]."/img/dfpic.gif";
$row["picname"] = $row["litpic"];
$row["typeurl"] = $this->GetListUrl($row["typeid"],$row["typedir"],$row["isdefault"],$row["defaultname"],$row["ispart"],$row["namerule2"],$row["siteurl"]);
$row["info"] = $row["description"];
$row["filename"] = $row["arcurl"];
$row["stime"] = GetDateMK($row["uptime"]);
$row["textlink"] = "<a href='".$row["filename"]."'>".$row["title"]."</a>";
$row["typelink"] = "[<a href='".$row["typeurl"]."'>".$row["typename"]."</a>]";
$row["imglink"] = "<a href='".$row["filename"]."'><img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'></a>";
$row["image"] = "<img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'>";
$row["phpurl"] = $GLOBALS["cfg_plus_dir"];
$row["templeturl"] = $GLOBALS["cfg_templets_dir"];
$row["memberurl"] = $GLOBALS["cfg_member_dir"];
//---------------------------
if(is_array($this->dtp2->CTags)){
foreach($this->dtp2->CTags as $k=>$ctag){
if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]);
else $this->dtp2->Assign($k,"");
}
}
$artlist .= $this->dtp2->GetResult();
$tt = 1;
}//if hasRow
else{
if($tt == 0 && $this->KType == 1){
$sp1 = new SearchView($this->TypeID,$this->Keyword,$this->ChannelType,$this->SearchType,0,$this->cacheid);
$sp1->Display();
$sp1->Close();
exit;
}else{
$artlist .= '';
}
}
}//Loop Line
$this->dsql->FreeResult("al");
return $artlist;
}
//---------------------------------
//获取动态的分页列表
//---------------------------------
function GetPageListDM($list_len)
{
global $id;
$prepage="";
$nextpage="";
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0) return "共1页/".$this->TotalResult."条";
if($this->TotalResult == 0) return "共0页/".$this->TotalResult."条";
$purl = $this->GetCurUrl();
$geturl = "keyword=".urlencode($this->Keyword)."&searchtype=".$this->SearchType;
$geturl .= "&channeltype=".$this->ChannelType;
$geturl .= "&kwtype=".$this->KType."&pagesize=".$this->PageSize;
$geturl .= "&typeid=".$this->TypeID."&cacheid=".$this->cacheid."&";
$hidenform = "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";
$hidenform .= "<input type='hidden' name='TotalResult' value='".$this->TotalResult."'>\r\n";
$purl .= "?".$geturl;
//获得上一页和下一页的链接
if($this->PageNo != 1){
$prepage.="<a href='".$purl."PageNo=$prepagenum'>上一页</a>\r\n";
$indexpage="<a href='".$purl."PageNo=1'>首页</a>\r\n";
}
else{
$indexpage="<a>首页</a>\r\n";
}
if($this->PageNo!=$totalpage && $totalpage>1){
$nextpage.="<a href='".$purl."PageNo=$nextpagenum'>下一页</a>\r\n";
$endpage="<a href='".$purl."PageNo=$totalpage'>末页</a>\r\n";
}
else{
$endpage="<a>末页</a>\r\n";
}
//获得数字链接
$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.= "<strong>$j</strong>\r\n";
else $listdd.="<a href='".$purl."PageNo=$j'>".$j."</a>\r\n";
}
$plist = "";
$plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
$plist .= $indexpage;
$plist .= $prepage;
$plist .= $listdd;
$plist .= $nextpage;
$plist .= $endpage;
if($totalpage>$total_list){
$plist.="<input type='text' name='PageNo' style='width:30px;height:18px' value='".$this->PageNo."'>\r\n";
$plist.="<input type='submit' name='plistgo' value='GO' style='width:24px;height:18px;font-size:9pt'>\r\n";
}
$plist .= "</form>\r\n";
return $plist;
}
//--------------------------
//获得一个指定的频道的链接
//--------------------------
function GetListUrl($typeid,$typedir,$isdefault,$defaultname,$ispart,$namerule2)
{
return GetTypeUrl($typeid,MfTypedir($typedir),$isdefault,$defaultname,$ispart,$namerule2);
}
//---------------
//获得当前的页面文件的url
//----------------
function GetCurUrl()
{
if(!empty($_SERVER["REQUEST_URI"])){
$nowurl = $_SERVER["REQUEST_URI"];
$nowurls = explode("?",$nowurl);
$nowurl = $nowurls[0];
}
else
{ $nowurl = $_SERVER["PHP_SELF"]; }
return $nowurl;
}
}//End Class
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -