function MakePublicTag(&$thisObj,&$tagObj,&$partObj,&$typeLink,$envTypeid=0,$envArcid=0,$envChannelid=0)
{
	//解析模板
 	//-------------------------
 	if( is_array($tagObj->CTags) )
 	{
 		 foreach($tagObj->CTags as $tagid=>$ctag)
 		 {
 			 $tagname = $ctag->GetName();
 			 //字段
 			 if($tagname=="field"){
 					if(isset($thisObj->Fields[$ctag->GetAtt('name')]))
 					  $tagObj->Assign($tagid,$thisObj->Fields[$ctag->GetAtt('name')]);
 					else
 					  $tagObj->Assign($tagid,"");
 			 }
 			 //单个栏目
 			 else if($tagname=="onetype"||$tagname=="type"){
 				   $typeid = $ctag->GetAtt('typeid');
 				   if($typeid=="") $typeid = 0;
 				   if($typeid=="") $typeid = $envTypeid;
 				   $tagObj->Assign($tagid,$partObj->GetOneType($typeid,$ctag->GetInnerText()));
 			 }
 			 //下级频道列表
 			 else if($tagname=="channel"){
 				  $typeid = trim($ctag->GetAtt('typeid'));
 				  if( empty($typeid) && $envTypeid > 0 ){
 					  $typeid = $envTypeid;
 				  	$reid = $typeLink->TypeInfos['reID'];
 				  }else{
 					  $reid=0;
 				  }
 				  $tagObj->Assign($tagid,
 				      $typeLink->GetChannelList(
 				          $typeid,$reid,$ctag->GetAtt("row"),
 				          $ctag->GetAtt("type"),$ctag->GetInnerText(),
 				          $ctag->GetAtt("col"),$ctag->GetAtt("tablewidth"),
 				          $ctag->GetAtt("currentstyle")
 				      )
 				  );
 			 }
 			 //热门关键字
 			 else if($tagname=="hotwords"){
 				 $tagObj->Assign($tagid,
 				 GetHotKeywords($thisObj->dsql,$ctag->GetAtt('num'),$ctag->GetAtt('subday'),$ctag->GetAtt('maxlength')));
 			 }
 			 //自定义标记
 			 else if($tagname=="mytag"){
 				 $tagObj->Assign($tagid,
 				   $partObj->GetMyTag($envTypeid,$ctag->GetAtt("name"),$ctag->GetAtt("ismake"))
 				 );
 			 }
 			 //广告代码
 			 else if($tagname=="myad"){
 				 $tagObj->Assign($tagid,
 				   $partObj->GetMyAd($envTypeid,$ctag->GetAtt("name"))
 				 );
 			 }
 			 //频道下级栏目文档列表
 			 else if($tagname=="channelartlist"){
 				  //类别ID
 				  if(trim($ctag->GetAtt('typeid'))=="" && $envTypeid!=0){  $typeid = $envTypeid;  }
 				  else{ $typeid = trim( $ctag->GetAtt('typeid') ); }
 				  $tagObj->Assign($tagid,
 				      $partObj->GetChannelList($typeid,$ctag->GetAtt('col'),$ctag->GetAtt('tablewidth'),$ctag->GetInnerText())
 				  );
 			 }
 			 //投票
 			 else if($tagname=="vote"){
 				  $tagObj->Assign($tagid,
				     $partObj->GetVote(
				        $ctag->GetAtt("id"),$ctag->GetAtt("lineheight"),
                $ctag->GetAtt("tablewidth"),$ctag->GetAtt("titlebgcolor"),
                $ctag->GetAtt("titlebackground"),$ctag->GetAtt("tablebgcolor")
             )
			    );
 			 }
 			 //友情链接
 			 //------------------
 			 else if($tagname=="friendlink"||$tagname=="flink")
 			 {
 				  $tagObj->Assign($tagid,
 				     $partObj->GetFriendLink(
 				        $ctag->GetAtt("type"),$ctag->GetAtt("row"),$ctag->GetAtt("col"),
 				        $ctag->GetAtt("titlelen"),$ctag->GetAtt("tablestyle"),$ctag->GetAtt("linktyle"),$ctag->GetInnerText()
 				     )
 				  );
 			 }
 			 //站点新闻
 			 //---------------------
 			 else if($tagname=="mynews")
 			 {
 				 $tagObj->Assign($tagid,
 				    $partObj->GetMyNews($ctag->GetAtt("row"),$ctag->GetAtt("titlelen"),$ctag->GetInnerText())
 				 );
 			 }
 			 //调用论坛主题
 			 //----------------
 			 else if($tagname=="loop")
 			 {
 				  $tagObj->Assign($tagid,
				    $partObj->GetTable(
					     $ctag->GetAtt("table"),
					     $ctag->GetAtt("row"),
					     $ctag->GetAtt("sort"),
					     $ctag->GetAtt("if"),
					     $ctag->GetInnerText()
					  )
			    );
 			 }
 			 //数据表操作
 			 else if($tagname=="sql"){
 				  $tagObj->Assign($tagid,
				     $partObj->GetSql($ctag->GetAtt("sql"),$ctag->GetInnerText())
			    );
 			 }
 			 else if($tagname=="tag"){
 			 	if($ctag->GetAtt('type') == 'current'){
					$arcid = $thisObj->ArcID;
	 				 $tagObj->Assign($tagid,
	 				 	GetCurrentTags($thisObj->dsql,$arcid, $ctag->GetInnerText())
				   );
 			 	}else{
	 				 //数据表操作
	 				 $tagObj->Assign($tagid,
					    $partObj->GetTags($ctag->GetAtt("row"),$ctag->GetAtt("sort"),$ctag->GetInnerText())
				   );
				}
 			 }
 			 else if($tagname=="toparea"){
 				 //数据表操作
 				 $tagObj->Assign($tagid,
				    $partObj->gettoparea($ctag->GetInnerText())
			   );
 			 }
 			 //特定条件的文档调用
 			 else if($tagname=="arclist"||$tagname=="artlist"||$tagname=="hotart"
 			 ||$tagname=="imglist"||$tagname=="imginfolist"||$tagname=="coolart")
 			 {

 				  $channelid = $ctag->GetAtt("channelid");
 				  if($tagname=="imglist"||$tagname=="imginfolist"){ $listtype = "image"; }
 				  else if($tagname=="coolart"){ $listtype = "commend"; }
 				  else{ $listtype = $ctag->GetAtt('type'); }

 				  //对相应的标记使用不同的默认innertext
 				  if(trim($ctag->GetInnerText())!="") $innertext = $ctag->GetInnerText();
 				  else if($tagname=="imglist") $innertext = GetSysTemplets("part_imglist.htm");
 				  else if($tagname=="imginfolist") $innertext = GetSysTemplets("part_imginfolist.htm");
 				  else $innertext = GetSysTemplets("part_arclist.htm");

 				  if($tagname=="hotart") $orderby = "click";
 				  else $orderby = $ctag->GetAtt('orderby');

 				  $typeid = trim($ctag->GetAtt("typeid"));
 				  if(empty($typeid)) $typeid = $envTypeid;

 				  if(!empty($thisObj->TempletsFile)) $tmpfile = $thisObj->TempletsFile;
 				  else $tmpfile = '';

 				  if(!empty($thisObj->maintable)) $maintable = '#@__archives';
 				  else $maintable = '';

         if(!isset($titlelen)) $titlelen = 0;
         if(!isset($infolen)) $infolen = 0;

         $idlist = '';
 				  if($tagname=="likeart"){
 				  	if(!empty($thisObj->Fields['likeid'])) $idlist = $thisObj->Fields['likeid'];
 				  }else{
 				  	$idlist = $ctag->GetAtt("idlist");
 				  }
 				  if($idlist!=''){ $typeid = '0'; $channelid = '0';}

 				  $tagObj->Assign($tagid,
 				      $partObj->GetArcList(
 				         $tmpfile,
 				         $typeid,
 				         $ctag->GetAtt("row"),
 				         $ctag->GetAtt("col"),
					       $ctag->GetAtt("titlelen"),
					       $ctag->GetAtt("infolen"),
 				         $ctag->GetAtt("imgwidth"),
					       $ctag->GetAtt("imgheight"),
 				         $listtype,
 				         $orderby,
					       $ctag->GetAtt("keyword"),
 				         $innertext,
					       $ctag->GetAtt("tablewidth"),
 				         0,$idlist,$channelid,
 				         $ctag->GetAtt("limit"),
 				         $ctag->GetAtt("att"),
 				         $ctag->GetAtt("orderway"),
					       $ctag->GetAtt("subday"),
					       -1,
					       $ctag->GetAtt("ismember"),
					       $maintable
 				      )
 				  );
 			}
 			else if($tagname=="groupthread")
 			{
 				 //圈子主题
				  $tagObj->Assign($tagid,
				      $partObj->GetThreads($ctag->GetAtt("gid"),$ctag->GetAtt("row"),
				              $ctag->GetAtt("orderby"),$ctag->GetAtt("orderway"),$ctag->GetInnerText())
			    );
 		  }
 		  else if($tagname=="group")
 		  {
 				 //圈子
 				 $tagObj->Assign($tagid,
				    $partObj->GetGroups($ctag->GetAtt("row"),$ctag->GetAtt("orderby"),$ctag->GetInnerText())
			   );
 		 }
 		 else if($tagname=="ask")
 		 {
 				 //问答
 				 $tagObj->Assign($tagid,
				    $partObj->GetAsk($ctag->GetAtt("row"),$ctag->GetAtt("qtype"),$ctag->GetInnerText()),$ctag->GetAtt("typeid")
			   );
 		 }
 		 else if($tagname=="spnote")
 		 {
 		 	$noteid = $ctag->GetAtt('noteid');
 				 //专题节点
 				 $tagObj->Assign($tagid,
				    getNote($noteid, $thisObj)
			   );
 		 }
 		 //特定条件的文档调用
 		 else if($tagname=="arcfulllist"||$tagname=="fulllist"||$tagname=="likeart"||$tagname=="specart")
 		 {
 				  $channelid = $ctag->GetAtt("channelid");
 				  if($tagname=="specart"){ $channelid = -1; }

 				  $typeid = trim($ctag->GetAtt("typeid"));
 				  if(empty($typeid)) $typeid = $envTypeid;

 				  $idlist = '';
 				  if($tagname=="likeart"){
 				  	if(!empty($thisObj->Fields['likeid'])) $idlist = $thisObj->Fields['likeid'];
 				  }else{
 				  	$idlist = $ctag->GetAtt("idlist");
 				  }
 				  if($idlist!=''){ $typeid = '0'; $channelid = '0';}

 				  $tagObj->Assign($tagid,
 				      $partObj->GetFullList(
 				         $typeid,$channelid,$ctag->GetAtt("row"),$ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),
                 $ctag->GetAtt("keyword"),$ctag->GetInnerText(),$idlist,$ctag->GetAtt("limitv"),$ctag->GetAtt("ismember"),
                 $ctag->GetAtt("orderby"),$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight")
 				      )
 				  );
 			}
 		}//结束模板循环
 	}
}
 	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 ParseTemplet()
 	{
 		//global $envTypeid;
    //if(!isset($envTypeid)) $envTypeid = 0;
 		if(!is_array($this->dtp->CTags)) return "";
 		foreach($this->dtp->CTags as $tagid=>$ctag)
 		{
 			$tagname = $ctag->GetName();
 			if($tagname=="field"){
 				//获得 field 标记值
 				@$this->dtp->Assign($tagid,$this->Fields[$ctag->GetAtt('name')]);
 			}else if($tagname=="onetype"||$tagname=="type"){
 				//获得单个栏目属性
 				$this->dtp->Assign($tagid,$this->GetOneType($ctag->GetAtt('typeid'),$ctag->GetInnerText()));
 			}else if($tagname=="autochannel"){
 				//获得自动栏目内容
 				$this->dtp->Assign($tagid,
 				     $this->GetAutoChannel($ctag->GetAtt('partsort'),$ctag->GetInnerText(),$ctag->GetAtt('typeid'))
 				);
 			}else if($tagname=="arclist"||$tagname=="artlist"||$tagname=="likeart"||$tagname=="hotart"||
 			$tagname=="imglist"||$tagname=="imginfolist"||$tagname=="coolart"||$tagname=="specart"||$tagname=="autolist")
 			{  //特定的文章列表
 				  $autopartid = 0;
 				  $channelid = $ctag->GetAtt("channelid");
 				  if($tagname=="imglist"||$tagname=="imginfolist"){ $listtype = "image"; }
 				  else if($tagname=="specart"){ $channelid = -1; $listtype=""; }
 				  else if($tagname=="coolart"){ $listtype = "commend"; }
 				  else if($tagname=="autolist"){ $autopartid = $ctag->GetAtt('partsort'); }
 				  else{ $listtype = $ctag->GetAtt('type'); }

 				  //排序
 				  if($ctag->GetAtt('sort')!="") $orderby = $ctag->GetAtt('sort');
 				  else if($tagname=="hotart") $orderby = "click";
 				  else $orderby = $ctag->GetAtt('orderby');

 				  //对相应的标记使用不同的默认innertext
 				  if(trim($ctag->GetInnerText())!="") $innertext = $ctag->GetInnerText();
 				  else if($tagname=="imglist") $innertext = GetSysTemplets("part_imglist.htm");
 				  else if($tagname=="imginfolist") $innertext = GetSysTemplets("part_imginfolist.htm");
 				  else $innertext = GetSysTemplets("part_arclist.htm");

 				  $typeid = trim($ctag->GetAtt("typeid"));
 				  if(empty($typeid)) $typeid = $this->TypeID;
					if(!isset($titlelen)) $titlelen = '';
					if(!isset($infolen)) $infolen = '';

 				  $this->dtp->Assign($tagid,
 				      $this->GetArcList(
 				        $this->TempletsFile,
 				        $typeid,$ctag->GetAtt("row"),$ctag->GetAtt("col"),
 				        $ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight"),
 				        $ctag->GetAtt("type"),$orderby,$ctag->GetAtt("keyword"),$innertext,
                $ctag->GetAtt("tablewidth"),0,"",$channelid,$ctag->GetAtt("limit"),$ctag->GetAtt("att"),
                $ctag->GetAtt("orderway"),$ctag->GetAtt("subday"),$autopartid,$ctag->GetAtt("ismember")
             )
 				  );
 			}else if($tagname=="channelartlist"){
 				 //获得频道的下级栏目列表及文档列表
 				 $this->dtp->Assign($tagid,
 				     $this->GetChannelList(trim($ctag->GetAtt('typeid')),$ctag->GetAtt('col'),$ctag->GetAtt('tablewidth'),$ctag->GetInnerText())
 				 );
 			}else if($tagname=="hotwords"){
 				 //热门关键字
 				 $this->dtp->Assign($tagid,
 				 GetHotKeywords($this->dsql,$ctag->GetAtt('num'),$ctag->GetAtt('subday'),$ctag->GetAtt('maxlength'),$ctag->GetAtt('orderby')));
 			}
 			else if($tagname=="channel"){
 				//获得栏目连接列表
 				$typeid = trim($ctag->GetAtt('typeid'));
 				if( empty($typeid) ){
 					$typeid = $this->TypeID;
 					$reid = $this->TypeLink->TypeInfos['reID'];
 				}else{
 					$reid=0;
 				}
 				$this->dtp->Assign($tagid,
 				   $this->TypeLink->GetChannelList($typeid,$reid,$ctag->GetAtt("row"),
 				   $ctag->GetAtt("type"),$ctag->GetInnerText(),
 				   $ctag->GetAtt("col"),$ctag->GetAtt("tablewidth"),
 				   $ctag->GetAtt("currentstyle"))
 				);
 			}else if($tagname=="mytag"){
 				//自定义标记
 				$this->dtp->Assign($tagid,
 				   $this->GetMyTag($ctag->GetAtt("typeid"),$ctag->GetAtt("name"),$ctag->GetAtt("ismake"))
 				);
 			}else if($tagname=="myad"){
 				//广告代码
 				$this->dtp->Assign($tagid,
 				  $this->GetMyAd($ctag->GetAtt("typeid"),$ctag->GetAtt("name"))
 				);
 			}else if($tagname=="vote"){
 				//投票
 				$this->dtp->Assign($tagid,
				   $this->GetVote(
				     $ctag->GetAtt("id"),$ctag->GetAtt("lineheight"),
             $ctag->GetAtt("tablewidth"),$ctag->GetAtt("titlebgcolor"),
             $ctag->GetAtt("titlebackground"),$ctag->GetAtt("tablebgcolor")
           )
			   );
 			}else if($tagname=="friendlink"||$tagname=="flink"){
 				//友情链接
 				$this->dtp->Assign($tagid,
 				  $this->GetFriendLink($ctag->GetAtt("type"),
 				    $ctag->GetAtt("row"),$ctag->GetAtt("col"),
 				    $ctag->GetAtt("titlelen"),$ctag->GetAtt("tablestyle"),
 				    $ctag->GetAtt("linktype"),
 				    $ctag->GetInnerText()
 				  )
 				);
 			}else if($tagname=="mynews"){
 				//站内新闻
 				$this->dtp->Assign($tagid,
 				  $this->GetMyNews($ctag->GetAtt("row"),$ctag->GetAtt("titlelen"),$ctag->GetInnerText())
 				);
			}else if($tagname=="toparea"){
 				$this->dtp->Assign($tagid,
 				  $this->GetTopArea($ctag->GetInnerText())
 				);
 			}else if($tagname=="loop"){
 				//数据表操作
 				$this->dtp->Assign($tagid,
				  $this->GetTable($ctag->GetAtt("table"),
					  $ctag->GetAtt("row"),$ctag->GetAtt("sort"),
					  $ctag->GetAtt("if"),$ctag->GetInnerText()
					)
			  );
 			}else if($tagname=="sql"){
 				//数据表操作
 				$this->dtp->Assign($tagid,
				    $this->GetSql($ctag->GetAtt("sql"),$ctag->GetInnerText())
			  );
 			}else if($tagname=="tag"){
 				//自定义宏标签
 				$this->dtp->Assign($tagid,
				    $this->GetTags($ctag->GetAtt("row"),$ctag->GetAtt("sort"),$ctag->GetInnerText())
			  );
 			}
 			else if($tagname=="groupthread")
 			{
 				 //圈子主题
 				 $this->dtp->Assign($tagid,
				    $this->GetThreads($ctag->GetAtt("gid"),$ctag->GetAtt("row"),
				            $ctag->GetAtt("orderby"),$ctag->GetAtt("orderway"),$ctag->GetInnerText())
			   );
 		  }
 		  else if($tagname=="group")
 		  {
 				 //圈子
 				 $this->dtp->Assign($tagid,
				    $this->GetGroups($ctag->GetAtt("row"),$ctag->GetAtt("orderby"),$ctag->GetInnerText())
			   );
 		 }
 		 else if($tagname=="ask")
 		 {
 				 //问答
 				 $this->dtp->Assign($tagid,
				    $this->GetAsk($ctag->GetAtt("row"),$ctag->GetAtt("qtype"),$ctag->GetInnerText()),$ctag->GetAtt("typeid")
			   );
 		 }
 		 //特定条件的文档调用
 		 else if($tagname=="arcfulllist"||$tagname=="fulllist"||$tagname=="likeart"||$tagname=="specart")
 		 {
 				  $channelid = $ctag->GetAtt("channelid");
 				  if($tagname=="specart"){ $channelid = -1; }

 				  $typeid = trim($ctag->GetAtt("typeid"));
 				  if(empty($typeid)) $typeid = $this->TypeID;

 				  $this->dtp->Assign($tagid,
 				      $this->GetFullList(
 				         $typeid,$channelid,$ctag->GetAtt("row"),$ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),
                 $ctag->GetAtt("keyword"),$ctag->GetInnerText(),$ctag->GetAtt("idlist"),$ctag->GetAtt("limitv"),$ctag->GetAtt("ismember"),
                 $ctag->GetAtt("orderby"),$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight")
 				      )
 				  );
 			}
 		}//End Foreach
 	}