DedeCMS core typelink. class. PHP digest notes
- 2020-03-31 20:31:45
- OfStack
Note: '//+' is an additional note added by myself
The Class TypeLink
{
Var $typeDir;
Var $DSQL;
Var $TypeID; / / + category ID
Var $baseDir; //+ site root address
Var $modDir; //+ template directory
Var $indexUrl; //+ home page link address
Var $indexName; //+ home page link name
Var $TypeInfos; //+ category information
Var $SplitSymbol; //+ column position spacing symbol
Var $valuePosition; / / + homepage > Domestic > Two sessions dynamic > (tape connection)
Var $valuePositionName; / / + homepage > Domestic > Two sessions dynamic > (without connection)
Var $OptionArrayList; //+ class drop down list
Function 1: get a link to a certain type of object
Function 2, get a list of links to a certain category of objects such as: 'category 1 > Category 2 > 'in this form.
Function 3, get a list of categories the advanced search function highsearch.php USES this function
The four functions,
// gets the category associated with this class, which is applied to the template tag {dede:channel}{/dede:channel}
The value of //$typetype is: sun sub-category, self, sibling category, top, top-level category
The Class TypeLink
{
Var $typeDir;
Var $DSQL;
Var $TypeID; / / + category ID
Var $baseDir; //+ site root address
Var $modDir; //+ template directory
Var $indexUrl; //+ home page link address
Var $indexName; //+ home page link name
Var $TypeInfos; //+ category information
Var $SplitSymbol; //+ column position spacing symbol
Var $valuePosition; / / + homepage > Domestic > Two sessions dynamic > (tape connection)
Var $valuePositionName; / / + homepage > Domestic > Two sessions dynamic > (without connection)
Var $OptionArrayList; //+ class drop down list
Function 1: get a link to a certain type of object
//Gets the URL of a category connection
function GetOneTypeUrl($typeinfos)
{
return GetTypeUrl();
}
//Gets hyperlink information for a class object
function GetOneTypeLink($typeinfos)
{
$typepage = $this->GetOneTypeUrl($typeinfos);
$typelink = "<a href='".$typepage."'>".$typeinfos['typename']."</a>";
return $typelink;
}
Function 2, get a list of links to a certain category of objects such as: 'category 1 > Category 2 > 'in this form.
//Islink indicates whether the returned list has a connection
//+ SplitSymbol column location spacing symbol dede system default to '-'
function GetPositionLink($islink=true)
{ //+ get the home page link name
$indexpage = "<a href='".$this->indexUrl."'>".$this->indexName."</a>";
...
...
else
{
if($islink)
{
$this->valuePosition = $this->GetOneTypeLink($this->TypeInfos);
if($this->TypeInfos['reid']!=0)
{
//Invoke recursive logic
$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)
{
//Invoke recursive logic
$this->LogicGetPosition($this->TypeInfos['reid'],false);
}
return $this->valuePositionName;
}
}
}
//Gets a list of links to a certain class of objects, the recursive logic section
function LogicGetPosition($id,$islink)
{
$this->dsql->SetQuery(" SQL The query ");
$tinfos = $this->dsql->GetOne();
if($islink)
{ //+ column strap connection
$this->valuePosition = $this->GetOneTypeLink($tinfos).$this->SplitSymbol.$this->valuePosition;
}
else
{ //+ list with no join
$this->valuePositionName = $tinfos['typename'].$this->SplitSymbol.$this->valuePositionName;
}
if($tinfos['reid']>0)
{ //+ recursion
$this->LogicGetPosition($tinfos['reid'],$islink);
}
}
Function 3, get a list of categories the advanced search function highsearch.php USES this function
//Hid refers to the default selected category, and 0 means "please select category" or "open category".
//Oper is a category that the user is allowed to manage, and 0 represents all categories
//Channeltype refers to the content type of a category, and 0 means unlimited channels
function GetOptionArray($hid=0,$oper=0,$channeltype=0,$usersg=0)
{
return $this->GetOptionList($hid,$oper,$channeltype,$usersg);
}
function GetOptionList($hid=0,$oper=0,$channeltype=0,$usersg=0)
{
return $this->OptionArrayList;
}
//+ adds '-' recursively to subcategories
function LogicGetOptionArray($id, $step, $oper=0)
{
}
The four functions,
// gets the category associated with this class, which is applied to the template tag {dede:channel}{/dede:channel}
The value of //$typetype is: sun sub-category, self, sibling category, top, top-level category
function GetChannelList($typeid=0,$reid=0,$row=8,$typetype='sun',$innertext='',
$col=1,$tablewidth=100,$myinnertext='')
{
}
}