?? inc_taglist_view.php
字號:
<?php
require_once(DEDEINC."/pub_oxwindow.php");
//打開所有標記,開啟此項允許你使用封面模板的所有標記,但會對性能造成一定的影響
$cfg_OpenAll = false;
include_once(DEDEINC."/inc_arcpart_view.php");
include_once(DEDEINC."/inc_pubtag_make.php");
/******************************************************
//Copyright 2004-2006 by DedeCms.com itprato
//本類的用途是用于瀏覽含有某Tag的文檔
******************************************************/
@set_time_limit(0);
class TagList
{
var $dsql;
var $dtp;
var $dtp2;
var $TypeLink;
var $PageNo;
var $TotalPage;
var $TotalResult;
var $PageSize;
var $ListType;
var $Fields;
var $PartView;
var $Tag;
var $Templet;
var $TagInfos;
var $TempletsFile;
var $TagID;
//-------------------------------
//php5構造函數
//-------------------------------
function __construct($keyword,$templet)
{
$this->Templet = $templet;
$this->Tag = $keyword;
$this->dsql = new DedeSql(false);
$this->dtp = new DedeTagParse();
$this->dtp->SetNameSpace("dede","{","}");
$this->dtp2 = new DedeTagParse();
$this->dtp2->SetNameSpace("field","[","]");
$this->TypeLink = new TypeLink(0);
$this->Fields['tag'] = $keyword;
$this->Fields['position'] = " ".$keyword;
$this->Fields['title'] = " 標簽:{$keyword} ";
$this->TempletsFile = '';
//設置一些全局參數的值
foreach($GLOBALS['PubFields'] as $k=>$v) $this->Fields[$k] = $v;
$this->PartView = new PartView(0);
//讀取Tag信息
if($this->Tag!='')
{
$this->TagInfos = $this->dsql->GetOne("Select * From `#@__tag_index` where tagname like '{$this->Tag}' ");
if(!is_array($this->TagInfos))
{
$fullsearch = $GLOBALS['cfg_phpurl']."/search.php?keyword=".$this->Tag."&searchtype=titlekeyword";
$msg = "系統無此標簽,可能已經移除!<br /><br />你還可以嘗試通過搜索程序去搜索這個關鍵字:<a href='$fullsearch'>前往搜索>></a>";
ShowMsgWin($msg,"<a href='tag.php'>Tag標簽</a> >> 錯誤提示");
$this->dsql->Close();
exit();
}
$this->TagID = $this->TagInfos['id'];
}
//初始化模板
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style'].'/'.$this->Templet;
if(!file_exists($tempfile)||!is_file($tempfile)){
echo "模板文件:'".$tempfile."' 不存在,無法解析文檔!";
exit();
}
$this->dtp->LoadTemplate($tempfile);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$tempfile);
}
//php4構造函數
//---------------------------
function TagList($keyword,$templet){
$this->__construct($keyword,$templet);
}
//---------------------------
//關閉相關資源
//---------------------------
function Close()
{
@$this->dsql->Close();
@$this->TypeLink->Close();
@$this->PartView->Close();
}
//------------------
//統計列表里的記錄
//------------------
function CountRecord()
{
global $cfg_list_son;
//統計數據庫記錄
$this->TotalResult = -1;
if(isset($GLOBALS['TotalResult'])) $this->TotalResult = $GLOBALS['TotalResult'];
if(isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo'];
else $this->PageNo = 1;
if($this->TotalResult==-1)
{
$addSql = " arcrank > -1 ";
$cquery = "Select count(*) as dd From #@__tag_list where tid = '{$this->TagID}' And arcrank>-1 ";
$row = $this->dsql->GetOne($cquery);
$this->TotalResult = $row['dd'];
//更新Tag信息
$ntime = time();
//更新瀏覽量和記錄數
$upquery = "Update #@__tag_index set result='{$row['dd']}',count=count+1,weekcc=weekcc+1,monthcc=monthcc+1 where id='{$this->TagID}' ";
$this->dsql->ExecuteNoneQuery($upquery);
$oneday = 24 * 3600;
//周統計
if(ceil( ($ntime - $this->TagInfos['weekup'])/$oneday )>7){
$this->dsql->ExecuteNoneQuery("Update #@__search_keywords set weekcc=0,weekup='{$ntime}' where id='{$this->TagID}' ");
}
//月統計
if(ceil( ($ntime - $this->TagInfos['monthup'])/$oneday )>30){
$this->dsql->ExecuteNoneQuery("Update #@__search_keywords set monthcc=0,monthup='{$ntime}' where id='{$this->TagID}' ");
}
}
$ctag = $this->dtp->GetTag("page");
if(!is_object($ctag)){ $ctag = $this->dtp->GetTag("list"); }
if(!is_object($ctag)) $this->PageSize = 25;
else{
if($ctag->GetAtt("pagesize")!="") $this->PageSize = $ctag->GetAtt("pagesize");
else $this->PageSize = 25;
}
$this->TotalPage = ceil($this->TotalResult/$this->PageSize);
}
//------------------
//顯示列表
//------------------
function Display()
{
if($this->Tag!='') $this->CountRecord();
$this->ParseTempletsFirst();
if($this->Tag!='') $this->ParseDMFields($this->PageNo,0);
$this->Close();
$this->dtp->Display();
}
//--------------------------------
//解析模板,對固定的標記進行初始給值
//--------------------------------
function ParseTempletsFirst()
{
//對公用標記的解析,這里對對象的調用均是用引用調用的,因此運算后會自動改變傳遞的對象的值
MakePublicTag($this,$this->dtp,$this->PartView,$this->TypeLink,0,0,0);
}
//--------------------------------
//解析模板,對內容里的變動進行賦值
//--------------------------------
function ParseDMFields($PageNo,$ismake=1)
{
foreach($this->dtp->CTags as $tagid=>$ctag){
if($ctag->GetName()=="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"),
$ctag->GetAtt("listtype"),
$ctag->GetAtt("orderby"),
$InnerText,
$ctag->GetAtt("tablewidth"),
$ismake,
$ctag->GetAtt("orderway")
)
);
}
else if($ctag->GetName()=="pagelist")
{
$list_len = trim($ctag->GetAtt("listsize"));
$ctag->GetAtt("listitem")=="" ? $listitem="info,index,pre,pageno,next,end,option" : $listitem=$ctag->GetAtt("listitem");
if($list_len=="") $list_len = 3;
if($ismake==0) $this->dtp->Assign($tagid,$this->GetPageListDM($list_len,$listitem));
else $this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem));
}
}
}
//----------------------------------
//獲得一個單列的文檔列表
//---------------------------------
function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250,
$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc')
{
global $cfg_list_son;
$t1 = ExecTime();
$getrow = ($row=="" ? 10 : $row);
if($limitstart=="") $limitstart = 0;
if($titlelen=="") $titlelen = 100;
if($infolen=="") $infolen = 250;
if($imgwidth=="") $imgwidth = 120;
if($imgheight=="") $imgheight = 120;
if($listtype=="") $listtype = "all";
if($orderby=="") $orderby="default";
else $orderby=strtolower($orderby);
if($orderWay=='') $orderWay = 'desc';
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col=1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
$innertext = trim($innertext);
if($innertext=="") $innertext = GetSysTemplets("list_fulllist.htm");
$idlists = '';
$this->dsql->SetQuery("Select aid From #@__tag_list where tid='{$this->TagID}' And arcrank>-1 limit $limitstart,$getrow");
//echo "Select aid From #@__tag_list where tid='{$this->TagID}' And arcrank>-1 limit $limitstart,$getrow";
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -