📄 inc_arclist_view.php
字号:
{
$this->Close();
header("location:".$this->TypeLink->TypeInfos['typedir']);
exit();
}
//ispart = 1 板块或 2 单独页面
else if($this->TypeLink->TypeInfos['ispart']>0)
{
$this->DisplayPartTemplets();
return '';
}
//ispart = 0 正常列表
if((empty($this->pageno) || $this->pageno==1)
&& $this->TypeLink->TypeInfos['ispart']==1)
{
$tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
$tempfile = $tmpdir."/".$tempfile;
if(!file_exists($tempfile)){
$tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_article.htm";
}
$this->dtp->LoadTemplate($tempfile);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$tempfile);
}
$this->LoadDmCatCache();
$this->ParseTempletsFirst();
$this->ParseDMFields($this->pageno,0);
$this->Close();
$this->dtp->Display();
}
//------------------
//创建单独模板页面
//------------------
function MakePartTemplets()
{
$nmfa = 0;
$tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
if($this->Fields['ispart']==1){
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
$tempfile = $tmpdir."/".$tempfile;
if(!file_exists($tempfile)){
$tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_article.htm";
}
$this->PartView->SetTemplet($tempfile);
}else if($this->Fields['ispart']==2){
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempone']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
if(is_file($tmpdir."/".$tempfile)) $this->PartView->SetTemplet($tmpdir."/".$tempfile);
else{ $this->PartView->SetTemplet("这是没有使用模板的单独页!","string"); $nmfa = "1";}
}else if($this->Fields['ispart']==3){
return '';
}
CreateDir($this->Fields['typedir']);
$makeUrl = $this->GetMakeFileRule($this->Fields['ID'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$makeUrl = ereg_replace("/{1,}","/",$makeUrl);
$makeFile = $this->GetTruePath().$makeUrl;
if($nmfa==0) $this->PartView->SaveToHtml($makeFile);
else{
if(!file_exists($makeFile)) $this->PartView->SaveToHtml($makeFile);
}
//$this->Close();
return $this->GetTrueUrl($makeUrl);
}
//------------------
//显示单独模板页面
//------------------
function DisplayPartTemplets()
{
$nmfa = 0;
$tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
if($this->Fields['ispart']==1){
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
$tempfile = $tmpdir."/".$tempfile;
if(!file_exists($tempfile)){
$tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_article.htm";
}
$this->PartView->SetTemplet($tempfile);
}else if($this->Fields['ispart']==2){
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempone']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
if(is_file($tmpdir."/".$tempfile)) $this->PartView->SetTemplet($tmpdir."/".$tempfile);
else{ $this->PartView->SetTemplet("这是没有使用模板的单独页!","string"); $nmfa = 1; }
}
CreateDir($this->Fields['typedir']);
$makeUrl = $this->GetMakeFileRule($this->Fields['ID'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$makeFile = $this->GetTruePath().$makeUrl;
if($nmfa==0) $this->PartView->Display();
else{
if(!file_exists($makeFile)) $this->PartView->Display();
else include($makeFile);
}
$this->Close();
}
//----------------------------
//获得站点的真实根路径
//----------------------------
function GetTruePath(){
if($this->Fields['siterefer']==1) $truepath = ereg_replace("/{1,}","/",$GLOBALS["cfg_basedir"]."/".$this->Fields['sitepath']);
else if($this->Fields['siterefer']==2) $truepath = $this->Fields['sitepath'];
else $truepath = $GLOBALS["cfg_basedir"];
return $truepath;
}
//----------------------------
//获得真实连接路径
//----------------------------
function GetTrueUrl($nurl){
if($this->Fields['moresite']==1){ $nurl = ereg_replace("/$","",$this->Fields['siteurl']).$nurl; }
return $nurl;
}
//--------------------------------
//解析模板,对固定的标记进行初始给值
//--------------------------------
function ParseTempletsFirst()
{
//对公用标记的解析,这里对对象的调用均是用引用调用的,因此运算后会自动改变传递的对象的值
MakePublicTag($this,$this->dtp,$this->PartView,$this->TypeLink,$this->TypeID,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));
}
else if($ctag->GetName()=="area"){
$areaid = trim($ctag->GetAtt('areaid'));
if(empty($areaid)){
$areaid = $this->areaid;
}
$areaid2 = trim($ctag->GetAtt('areaid2'));
if(empty($areaid2)){
$areaid2 = $this->areaid2;
}
$sub = trim($ctag->GetAtt('sub'));
if(empty($sub)){
$sub = 0;
}else{
$sub = 1;
}
$this->dtp->Assign($tagid, $this->getarea($areaid, $areaid2,$sub));
}
else if($ctag->GetName()=="smalltype"){
$this->dtp->Assign($tagid, $this->getsmalltype());
}
}
}
//----------------
//获得要创建的文件名称规则
//----------------
function GetMakeFileRule($typeid,$wname,$typedir,$defaultname,$namerule2)
{
$typedir = eregi_replace("{cmspath}",$GLOBALS['cfg_cmspath'],$typedir);
$typedir = ereg_replace("/{1,}","/",$typedir);
if($wname=="index")
{ return $typedir."/".$defaultname; }
else
{
$namerule2 = str_replace("{tid}",$typeid,$namerule2);
$namerule2 = str_replace("{typedir}",$typedir,$namerule2);
return $namerule2;
}
}
//获取小分类数据
function getsmalltype()
{
$str = '';
if($this->mysmalltypes){
//print_r($this->mysmalltypes);
$str = '<div class="c1"><strong>分类:</strong>';
foreach($this->mysmalltypes as $mysmalltype){
if($mysmalltype['id'] == $this->smalltypeid){
$str .= '<strong style="color:green">'.$mysmalltype['name'].'</strong> ';
continue;
}
$str .= '<a href="list.php?tid='.$this->TypeID;
if($this->areaid2){
$str .= '&areaid2='.$this->areaid2;
}elseif($this->areaid){
$str .= '&areaid='.$this->areaid;
}
$str .= '&smalltypeid='.$mysmalltype['id'].'">'.$mysmalltype['name']."</a>\n";
}
$str .= '</div>';
}
return $str;
}
//获得地区数据
function getarea($areaid, $areaid2,$sub=0)
{
$str = '';
$topareadata = '';
foreach($this->topareas as $toparea){
if($sub){
$topareadata .= '<option value="'.$toparea['id'].'">'.$toparea['name']."</option>\n";
continue;
}
if($toparea['id'] == $this->areaid){
$str .= '<strong style="color:green">'.$toparea['name'].'</strong> ';
continue;
}
$str .= '<a href="list.php?tid='.$this->TypeID;
if($this->smalltypeid){
$str .= '&smalltypeid='.$this->smalltypeid;
}
$str .= '&areaid='.$toparea['id'].'">'.$toparea['name'].'</a> ';
}
$str1 = '';
if($areaid && is_array($this->subareas[$areaid])){
foreach($this->subareas[$areaid] as $subarea){
if($subarea['id'] == $this->areaid2){
$str1 .= '<strong style="color:green">'.$subarea['name'].'</strong> ';
continue;
}
$str1 .= '<a href="list.php?tid='.$this->TypeID;
if($this->smalltypeid){
$str1 .= '&smalltypeid='.$this->smalltypeid;
}
$str1 .= '&areaid2='.$subarea['id'].'">'.$subarea['name'].'</a> ';
}
}
if($sub)
{
return $topareadata;
}else{
return '<div class="c1"><strong>地区:</strong>'.$str.'</div><div class="c2">'.$str1.'</div>';
}
}
//----------------------------------
//获得一个单列的文档列表
//---------------------------------
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();
$typeid=$this->TypeID;
if($row=="") $row = 10;
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';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -