📄 inc_arcpart_view.php
字号:
)
);
}
}//End Foreach
}
//------------------------------------
//获得限定模型或栏目的一个指定文档列表
//这个标记由于使用了缓存,并且处理数据是支持分表模式的,因此速度更快,但不能进行整站的数据调用
//---------------------------------
function GetArcList($templets='',$typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160,
$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword="",$innertext="",
$tablewidth="100",$arcid=0,$idlist="",$channelid=0,$limit="",$att=0,$order='desc',$subday=0,
$autopartid=-1,$ismember=0)
{
if(empty($autopartid)) $autopartid = -1;
if(empty($typeid)) $typeid=$this->TypeID;
if($autopartid!=-1){
$typeid = $this->GetAutoChannelID($autopartid,$typeid);
if($typeid==0) return "";
}
if(!isset($GLOBALS['__SpGetArcList'])) require_once(dirname(__FILE__)."/inc/inc_fun_SpGetArcList.php");
return SpGetArcList($this->dsql,$templets,$typeid,$row,$col,$titlelen,$infolen,$imgwidth,$imgheight,$listtype,
$orderby,$keyword,$innertext,$tablewidth,$arcid,$idlist,$channelid,$limit,$att,$order,$subday,$ismember);
}
//获得整站一个指定的文档列表
//---------------------------------
function GetFullList($typeid=0,$channelid=0,$row=10,$titlelen=30,$infolen=160,
$keyword='',$innertext='',$idlist='',$limitv='',$ismember=0,$orderby='',$imgwidth=120,
$imgheight=120,$autopartid=-1)
{
if(empty($autopartid)) $autopartid = -1;
if(empty($typeid)) $typeid=$this->TypeID;
if($autopartid!=-1){
$typeid = $this->GetAutoChannelID($autopartid,$typeid);
if($typeid==0) return "";
}
if(!isset($GLOBALS['__SpGetFullList'])) require_once(dirname(__FILE__)."/inc/inc_fun_SpFullList.php");
return SpGetFullList($this->dsql,$typeid,$channelid,$row,$titlelen,$infolen,$keyword,$innertext,
$idlist,$limitv,$ismember,$orderby,$imgwidth,$imgheight);
}
//GetChannelList($typeid=0,$col=2,$tablewidth=100,$innertext="")
//获得一个包含下级类目文档列表信息列表
//---------------------------------
function GetChannelList($typeid=0,$col=2,$tablewidth=100,$innertext="")
{
if($typeid=="") $typeid=0;
if($typeid==0 && !empty($this->TypeID)) $typeid = $this->TypeID;
if($col=="") $col=2;
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col = 1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
if($innertext=="") $innertext = GetSysTemplets("part_channelartlist.htm");
//获得类别ID总数的信息
//----------------------------
$typeids = "";
if($typeid==0){
$this->dsql->SetQuery("Select ID from #@__arctype where reID='0' And ispart<2 And ishidden<>'1' order by sortrank asc");
$this->dsql->Execute();
while($row = $this->dsql->GetObject()){ $typeids[] = $row->ID; }
}else{
if(!ereg(",",$typeid)){
$this->dsql->SetQuery("Select ID from #@__arctype where reID='".$typeid."' And ispart<2 And ishidden<>'1' order by sortrank asc");
$this->dsql->Execute();
while($row = $this->dsql->GetObject()){ $typeids[] = $row->ID; }
}else{
$ids = explode(",",$typeid);
foreach($ids as $id){
$id = trim($id); if($id!=""){ $typeids[] = $id; }
}
}
}
if(!is_array($typeids)) return "";
if(count($typeids)<1) return "";
$nrow = count($typeids);
$artlist = "";
$dtp = new DedeTagParse();
$dtp->LoadSource($innertext);
if($col>1){ $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n"; }
for($i=0;$i < $nrow;)
{
if($col>1) $artlist .= "<tr>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $artlist .= " <td width='$colWidth' valign='top'>\r\n";
if(isset($typeids[$i]))
{
foreach($dtp->CTags as $tid=>$ctag)
{
$sql = "select reid from #@__arctype where ID={$typeids[$i]}";
$trow = $this->dsql->GetOne($sql);
$tagname = $ctag->GetName();
if($tagname=="type"){
$dtp->Assign($tid,$this->GetOneType($typeids[$i],$ctag->GetInnerText()));
}
else if($tagname=="arclist")
{
$dtp->Assign($tid,$this->GetArcList($this->TempletsFile,$typeids[$i],$ctag->GetAtt('row'),
$ctag->GetAtt('col'),$ctag->GetAtt('titlelen'),$ctag->GetAtt('infolen'),
$ctag->GetAtt('imgwidth'),$ctag->GetAtt('imgheight'),$ctag->GetAtt('type'),
$ctag->GetAtt('orderby'),$ctag->GetAtt('keyword'),$ctag->GetInnerText(),
$ctag->GetAtt('tablewidth'),$ctag->GetAtt('arcid'),$ctag->GetAtt('idlist'),
$ctag->GetAtt('channel'),$ctag->GetAtt('limit'),$ctag->GetAtt('att'),
$ctag->GetAtt('order'),$ctag->GetAtt('subday')
-1,0,0
)
);
}
else if($tagname=="channel"){
$dtp->Assign($tid,
$this->TypeLink->GetChannelList(
$typeids[$i],$trow['reid'],$ctag->GetAtt("row"),
$ctag->GetAtt("type"),$ctag->GetInnerText(),
$ctag->GetAtt("col"),$ctag->GetAtt("tablewidth"),
$ctag->GetAtt("currentstyle")
)
);
}
}
$artlist .= $dtp->GetResult();
}
if($col>1) $artlist .= " </td>\r\n";
$i++;
}//Loop Col
if($col>1){ $artlist .= " </tr>\r\n";}
}//Loop Line
if($col>1) $artlist .= " </table>\r\n";
return $artlist;
}
//获取自定义标记的值
//---------------------------
function GetMyTag($typeid=0,$tagname="",$ismake="no")
{
if(trim($ismake)=="") $ismake = "no";
$body = $this->GetMyTagT($typeid,$tagname,"#@__mytag");
//编译
if($ismake=="yes"){
$this->pvCopy = new PartView($typeid);
$this->pvCopy->SetTemplet($body,"string");
$body = $this->pvCopy->GetResult();
}
return $body;
}
//获取广告值
//---------------------------
function GetMyAd($typeid=0,$tagname=""){
return $this->GetMyTagT($typeid,$tagname,"#@__myad");
}
function GetMyTagT($typeid,$tagname,$tablename){
if($tagname=="") return "";
if(trim($typeid)=="") $typeid=0;
if($this->TypeID > 0 && $typeid==0) $typeid = $this->TypeID;
$row = "";
$pids = Array();
if($typeid > 0) $pids = GetParentIDS($typeid,$this->dsql);
$idsql = " typeid='0' ";
foreach($pids as $v){ $idsql .= " Or typeid='$v' "; }
$row = $this->dsql->GetOne(" Select * From $tablename where tagname like '$tagname' And ($idsql) order by typeid desc ");
if(!is_array($row)){ return ""; }
else{
$nowtime = time();
if($row['timeset']==1 && ($nowtime<$row['starttime'] || $nowtime>$row['endtime']) )
{ $body = $row['expbody']; }
else{ $body = $row['normbody']; }
}
return $body;
}
function GetTopArea($innertext)
{
$str = '<option value="0">-不限-</option>';
$this->dsql->SetQuery("select * from #@__area where reid=0 order by disorder asc, id asc");
$this->dsql->Execute();
if(!$innertext){
$innertext = '<option value="[field:id/]">[field:name/]</option>';
}
while($row = $this->dsql->getarray())
{
$str .= str_replace(array('[field:id/]','[field:name/]'),array($row['id'],$row['name']),$innertext);
//'<option value="'.$row['id'].'">'.$row['name']."</option>\n";
}
return $str;
}
//获取站内新闻消息
//--------------------------
function GetMyNews($row=1,$titlelen=30,$innertext=""){
if($row=="") $row=1;
if($titlelen=="") $titlelen=30;
if($innertext=="") $innertext = GetSysTemplets("mynews.htm");
if($this->TypeID > 0){
$topid = SpGetTopID($this->TypeID);
$idsql = " where typeid='$topid' ";
}else{
$idsql = "";
}
$this->dsql->SetQuery("Select * from #@__mynews $idsql order by senddate desc limit 0,$row");
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$ctp->LoadSource($innertext);
$revalue = "";
while($row = $this->dsql->GetArray())
{
foreach($ctp->CTags as $tagid=>$ctag){
@$ctp->Assign($tagid,$row[$ctag->GetName()]);
}
$revalue .= $ctp->GetResult();
}
return $revalue;
}
//获得一个类目的链接信息
//------------------------------
function GetOneType($typeid,$innertext=""){
$row = $this->dsql->GetOne("Select ID,typedir,isdefault,defaultname,ispart,namerule2,typename,moresite,siterefer,siteurl,sitepath From #@__arctype where ID='$typeid'");
if(!is_array($row)) return "";
if(trim($innertext)=="") $innertext = GetSysTemplets("part_type_list.htm");
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","[","]");
$dtp->LoadSource($innertext);
if(!is_array($dtp->CTags)){ unset($dtp); return ""; }
else{
$row['typelink'] = GetTypeUrl($row['ID'],MfTypedir($row['typedir']),$row['isdefault'],
$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
foreach($dtp->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()])){ $dtp->Assign($tagid,$row[$ctag->GetName()]); }
}
$revalue = $dtp->GetResult();
unset($dtp);
return $revalue;
}
}
//----------------------------------------
//获得任意表的内容
//----------------------------------------
function GetTable($tablename="",$row=6,$sort="",$ifcase="",$InnerText=""){
$InnerText = trim($InnerText);
if($tablename==""||$InnerText=="") return "";
$row = AttDef($row,6);
if($sort!="") $sort = " order by $sort desc ";
if($ifcase!="") $ifcase=" where $ifcase ";
$revalue="";
$this->dsql->SetQuery("Select * From $tablename $ifcase $sort limit 0,$row");
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$ctp->LoadSource($InnerText);
while($row = $this->dsql->GetArray())
{
foreach($ctp->CTags as $tagid=>$ctag){
if(!empty($row[$ctag->GetName()]))
{ $ctp->Assign($tagid,$row[$ctag->GetName()]); }
}
$revalue .= $ctp->GetResult();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -