inc_archives_view.php
来自「强大的PHP内容管理系统尽量不要让站长把时间都花费在为您修正说明上。压缩包解压」· PHP 代码 · 共 677 行 · 第 1/2 页
PHP
677 行
}else{
$this->dtp->LoadSource($this->TempSource);
$this->ParseTempletsFirst();
}
$this->TempletsFile = ereg_replace("^".$cfg_basedir,'',$tempfile);
return true;
}
//--------------------------------
//解析模板,对固定的标记进行初始给值
//--------------------------------
function ParseTempletsFirst()
{
//对公用标记的解析,这里对对象的调用均是用引用调用的,因此运算后会自动改变传递的对象的值
MakePublicTag($this,$this->dtp,$this->PartView,$this->TypeLink,
$this->TypeLink->TypeInfos['ID'],$this->Fields['id'],$this->Fields['channel']);
}
//--------------------------------
//解析模板,对内容里的变动进行赋值
//--------------------------------
function ParseDMFields($pageNo,$ismake=1)
{
$this->NowPage = $pageNo;
$this->Fields['nowpage'] = $this->NowPage;
if($this->SplitPageField!="" &&
isset($this->Fields[$this->SplitPageField]))
{
$this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1];
}
//-------------------------
//解析模板
//-------------------------
if(is_array($this->dtp->CTags))
{
foreach($this->dtp->CTags as $tagid=>$ctag){
$tagname = $ctag->GetName();
if($tagname=="field")
{
$this->dtp->Assign($tagid,$this->GetField($ctag->GetAtt("name")));
}
else if($tagname=="pagebreak")
{
if($ismake==0)
{ $this->dtp->Assign($tagid,$this->GetPagebreakDM($this->TotalPage,$this->NowPage,$this->ArcID)); }
else
{ $this->dtp->Assign($tagid,$this->GetPagebreak($this->TotalPage,$this->NowPage,$this->ArcID)); }
}
else if($tagname=='prenext')
{
$this->dtp->Assign($tagid,$this->GetPreNext($ctag->GetAtt("get")));
}
else if($ctag->GetName()=="pagetitle")
{
if($ismake==0)
{ $this->dtp->Assign($tagid,$this->GetPageTitlesDM($ctag->GetAtt("style"),$pageNo)); }
else
{ $this->dtp->Assign($tagid,$this->GetPageTitlesST($ctag->GetAtt("style"),$pageNo)); }
}
else if($ctag->GetName()=="memberinfo")
{
$this->dtp->Assign($tagid,$this->GetMemberInfo());
}
else if($ctag->GetName()=="fieldlist")
{
$tagidnnertext = trim($ctag->GetInnerText());
if($tagidnnertext=="") $tagidnnertext = GetSysTemplets("tag_fieldlist.htm");
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadSource($tagidnnertext);
$oldSource = $dtp2->SourceString;
$oldCtags = $dtp2->CTags;
$res = "";
if(is_array($this->ChannelUnit->ChannelFields) && is_array($dtp2->CTags))
{
foreach($this->ChannelUnit->ChannelFields as $k=>$v)
{
$dtp2->SourceString = $oldSource;
$dtp2->CTags = $oldCtags;
$fname = $v['itemname'];
if($v['type']=="datetime"){
@$this->Fields[$k] = GetDateTimeMk($this->Fields[$k]);
}
foreach($dtp2->CTags as $tid=>$ctag){
if($ctag->GetName()=='name') $dtp2->Assign($tid,$fname);
else if($ctag->GetName()=='value') @$dtp2->Assign($tid,$this->Fields[$k]);
}
$res .= $dtp2->GetResult();
}
}
$this->dtp->Assign($tagid,$res);
}//end if
}//结束模板循环
}
}
//---------------------------
//关闭所占用的资源
//---------------------------
function Close()
{
$this->FixedValues = "";
$this->Fields = "";
if(is_object($this->dsql)) $this->dsql->Close();
if(is_object($this->ChannelUnit)) $this->ChannelUnit->Close();
if(is_object($this->TypeLink)) $this->TypeLink->Close();
if(is_object($this->PartView)) $this->PartView->Close();
}
//----------------------
//获得本文的投稿作者信息
//----------------------
function GetMemberInfo()
{
if(!isset($this->MemberInfos['ID'])){
if($this->Fields['memberID']==0) return '';
else{
$this->MemberInfos = $this->dsql->GetOne("Select ID,userid,uname,spacename,spaceimage From #@__member where ID='{$this->Fields['memberID']}' ");
}
}
if(!isset($this->MemberInfos['ID'])) return "";
else{
$minfo = "<a href='".$cfg_memberurl."/index.php?uid=".$this->MemberInfos['userid']."'>浏览 <font color='red'><b>";
$minfo .= $this->MemberInfos['uname']."</font></b> 的个人空间</a>\r\n";
return $minfo;
}
}
//--------------------------
//获取上一篇,下一篇链接
//--------------------------
function GetPreNext($gtype='')
{
$rs = "";
if(count($this->PreNext)<2)
{
$aid = $this->ArcID;
$next = " arc.ID>'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID asc ";
$pre = " arc.ID<'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID desc ";
$query = "Select arc.ID,arc.title,arc.shorttitle,
arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,
t.moresite,t.siteurl
from `{$this->MainTable}` arc left join #@__arctype t on arc.typeid=t.ID
where ";
$nextRow = $this->dsql->GetOne($query.$next);
$preRow = $this->dsql->GetOne($query.$pre);
if(is_array($preRow))
{
$mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);
$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";
}
else{
$this->PreNext['pre'] = "上一篇:没有了 ";
}
if(is_array($nextRow))
{
$mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);
$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";
}
else{
$this->PreNext['next'] = "下一篇:没有了 ";
}
}
if($gtype=='pre'){
$rs = $this->PreNext['pre'];
}
else if($gtype=='next'){
$rs = $this->PreNext['next'];
}
else{
$rs = $this->PreNext['pre']." ".$this->PreNext['next'];
}
return $rs;
}
//------------------------
//获得动态页面分页列表
//------------------------
function GetPagebreakDM($totalPage,$nowPage,$aid)
{
if($totalPage==1){ return ""; }
$PageList = ''; // "共".$totalPage."页: ";
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1) $PageList.="<a href='#'>上一页</a> ";
else{
if($nPage==1) $PageList.="<a href='view.php?aid=$aid'>上一页</a> ";
else $PageList.="<a href='view.php?aid=$aid&pageno=$nPage'>上一页</a> ";
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1){
if($nowPage!=1) $PageList.="<a href='view.php?aid=$aid'>1</a> ";
else $PageList.="<strong>1</strong> ";
}else{
$n = $i;
if($nowPage!=$i) $PageList.="<a href='view.php?aid=$aid&pageno=$i'>".$n."</a> ";
else $PageList.="<strong>$n</strong> ";
}
}
if($lPage <= $totalPage) $PageList.="<a href='view.php?aid=$aid&pageno=$lPage'>下一页</a> ";
else $PageList.= "<a href='#'>下一页</a>";
return $PageList;
}
//-------------------------
//获得静态页面分页列表
//-------------------------
function GetPagebreak($totalPage,$nowPage,$aid)
{
if($totalPage==1){ return ""; }
$PageList = ''; // "共".$totalPage."页: ";
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1) $PageList.="<a href='#'>上一页</a>";
else{
if($nPage==1) $PageList.="<a href='".$this->NameFirst.".".$this->ShortName."'>上一页</a> ";
else $PageList.="<a href='".$this->NameFirst."_".$nPage.".".$this->ShortName."'>上一页</a> ";
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1){
if($nowPage!=1) $PageList.="<a href='".$this->NameFirst.".".$this->ShortName."'>1</a> ";
else $PageList.="<strong>1</strong>";
}else{
$n = $i;
if($nowPage!=$i) $PageList.="<a href='".$this->NameFirst."_".$i.".".$this->ShortName."'>".$n."</a> ";
else $PageList.="<strong>$n</strong>";
}
}
if($lPage <= $totalPage) $PageList.="<a href='".$this->NameFirst."_".$lPage.".".$this->ShortName."'>下一页</a> ";
else $PageList.= "<a href='#'>下一页</a>";
return $PageList;
}
//-------------------------
//获得动态页面小标题
//-------------------------
function GetPageTitlesDM($styleName,$pageNo)
{
if($this->TotalPage==1){ return ""; }
if(count($this->SplitTitles)==0){ return ""; }
$i=1;
$aid = $this->ArcID;
if($styleName=='link')
{
$revalue = "";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<a href='view.php?aid=$aid&pageno=$i'>$v</a> \r\n";
else{
if($pageNo==$i) $revalue .= " $v \r\n";
else $revalue .= "<a href='view.php?aid=$aid&pageno=$i'>$v</a> \r\n";
}
$i++;
}
}else
{
$revalue = "<select id='dedepagetitles' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>\r\n";
else{
if($pageNo==$i) $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i' selected>{$i}、{$v}</option>\r\n";
else $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>\r\n";
}
$i++;
}
$revalue .= "</select>\r\n";
}
return $revalue;
}
//-------------------------
//获得静态页面小标题
//-------------------------
function GetPageTitlesST($styleName,$pageNo)
{
if($this->TotalPage==1){ return ""; }
if(count($this->SplitTitles)==0){ return ""; }
$i=1;
if($styleName=='link')
{
$revalue = "";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<a href='".$this->NameFirst.".".$this->ShortName."'>$v</a> \r\n";
else{
if($pageNo==$i) $revalue .= " $v \r\n";
else $revalue .= "<a href='".$this->NameFirst."_".$i.".".$this->ShortName."'>$v</a> \r\n";
}
$i++;
}
}else
{
$revalue = "<select id='dedepagetitles' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<option value='".$this->NameFirst.".".$this->ShortName."'>{$i}、{$v}</option>\r\n";
else{
if($pageNo==$i) $revalue .= "<option value='".$this->NameFirst."_".$i.".".$this->ShortName."' selected>{$i}、{$v}</option>\r\n";
else $revalue .= "<option value='".$this->NameFirst."_".$i.".".$this->ShortName."'>{$i}、{$v}</option>\r\n";
}
$i++;
}
$revalue .= "</select>\r\n";
}
return $revalue;
}
//----------------------------
//把指定关键字替换成链接
//----------------------------
function ReplaceKeyword($kw,&$body)
{
global $cfg_cmspath;
$maxkey = 5;
$kws = explode(" ",trim($kw));
$i=0;
$words = array();
$hrefs = array();
foreach($kws as $k){
$k = trim($k);
if($k!=""){
if($i > $maxkey) break;
$myrow = $this->dsql->GetOne("select * from #@__keywords where keyword='".addslashes($k)."' And rpurl<>'' ");
if(is_array($myrow)){
//$ka = "<a href='{$myrow['rpurl']}'>$k</a>";
//$body = str_replace($k,$ka,$body);
$words[] = $k;
$hrefs[] = $myrow['rpurl'];
}
$i++;
}
}
$body = highlight($body, $words, $hrefs);
return $body;
}
}//End Archives
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?