indexUrl = $GLOBALS['cfg_basehost'].$GLOBALS['cfg_indexurl']; $this->indexName = $GLOBALS['cfg_indexname']; $this->baseDir = $GLOBALS['cfg_basedir']; $this->modDir = $GLOBALS['cfg_templets_dir']; $this->SplitSymbol = $GLOBALS['cfg_list_symbol'] === " > "? "" : $GLOBALS['cfg_list_symbol']; $this->dsql = $GLOBALS['dsql']; $this->TypeID = $typeid; $this->valuePosition = ''; $this->valuePositionName = ''; $this->typeDir = ''; $this->OptionArrayList = ''; //载入类目信息 $query = "SELECT tp.*,ch.typename as ctypename,ch.addtable,ch.issystem FROM `#@__arctype` tp left join `#@__channeltype` ch on ch.id=tp.channeltype WHERE tp.id='$typeid' "; if($typeid > 0) { $this->TypeInfos = $this->dsql->GetOne($query); if(is_array($this->TypeInfos)) { $this->TypeInfos['tempindex'] = MfTemplet($this->TypeInfos['tempindex']); $this->TypeInfos['templist'] = MfTemplet($this->TypeInfos['templist']); $this->TypeInfos['temparticle'] = MfTemplet($this->TypeInfos['temparticle']); } } } //对于使用默认构造函数的情况 //GetPositionLink()将不可用 function TypeLink($typeid) { $this->__construct($typeid); } //关闭数据库连接,析放资源 function Close() { } //重设类目ID function SetTypeID($typeid) { $this->TypeID = $typeid; $this->valuePosition = ""; $this->valuePositionName = ""; $this->typeDir = ""; $this->OptionArrayList = ""; //载入类目信息 $query = " SELECT #@__arctype.*,#@__channeltype.typename as ctypename FROM #@__arctype left join #@__channeltype on #@__channeltype.id=#@__arctype.channeltype WHERE #@__arctype.id='$typeid' "; $this->dsql->SetQuery($query); $this->TypeInfos = $this->dsql->GetOne(); } //获得这个类目的路径 function GetTypeDir() { if(empty($this->TypeInfos['typedir'])) { return $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir']; } else { return $this->TypeInfos['typedir']; } } //获得某类目的链接列表 如:类目一>>类目二>> 这样的形式 //islink 表示返回的列表是否带连接 function GetPositionLink($islink=true) { if ( defined('DEDEMOB') ) { $indexpage = ""; } else{ $indexpage = ""; } if($this->valuePosition!="" && $islink) { return $this->valuePosition; } else if($this->valuePositionName!="" && !$islink) { return $this->valuePositionName; } else if($this->TypeID==0) { if($islink) { return $indexpage; } else { return "没指定分类!"; } } else { if($islink) { $this->valuePosition = $this->GetOneTypeLink($this->TypeInfos); if($this->TypeInfos['reid']!=0) { //调用递归逻辑 $this->LogicGetPosition($this->TypeInfos['reid'],true); } $this->valuePosition = $indexpage.$this->SplitSymbol.$this->valuePosition; return $this->valuePosition.$this->SplitSymbol; } else { $this->valuePositionName = $this->TypeInfos['typename']; if($this->TypeInfos['reid']!=0) { //调用递归逻辑 $this->LogicGetPosition($this->TypeInfos['reid'],false); } return $this->valuePositionName; } } } //获得名字列表 function GetPositionName() { return $this->GetPositionLink(false); } //获得某类目的链接列表,递归逻辑部分 function LogicGetPosition($id,$islink) { $this->dsql->SetQuery("SELECT id,reid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM #@__arctype WHERE id='".$id."'"); $tinfos = $this->dsql->GetOne(); if($islink) { $this->valuePosition = $this->GetOneTypeLink($tinfos).$this->SplitSymbol.$this->valuePosition; } else { $this->valuePositionName = $tinfos['typename'].$this->SplitSymbol.$this->valuePositionName; } if($tinfos['reid']>0) { $this->LogicGetPosition($tinfos['reid'],$islink); } else { return 0; } } //获得某个类目的超链接信息 function GetOneTypeLink($typeinfos) { $typepage = $this->GetOneTypeUrl($typeinfos); $typelink = "