DedeCMS core class TypeLink. class. php abstract notes

Source: Internet
Author: User
DedeCMS core class TypeLink. class. php abstract notes. learning php is to learn from and analyze it so that you can learn more. Note: '// +' indicates additional comments added to me.
Class TypeLink
{
Var $ typeDir;
Var $ dsql;
Var $ TypeID; // + Category ID
Var $ baseDir; // + site root URL
Var $ modDir; // + template directory
Var $ indexUrl; // + home page URL
Var $ indexName; // + home page link name
Var $ TypeInfos; // + category information
Var $ SplitSymbol; // + interval symbol of the column position
Var $ valuePosition; // + homepage> domestic> NPC and CPPCC News> (with connection)
Var $ valuePositionName; // + homepage> domestic> NPC and CPPCC News> (without connection)
Var $ OptionArrayList; // + category drop-down list
Function 1: obtain a link for a specific purpose

The code is as follows:


// Obtain the URL of a category connection
Function GetOneTypeUrl ($ typeinfos)
{
Return GetTypeUrl ();
}
// Obtain the hyperlink information of a category
Function GetOneTypeLink ($ typeinfos)
{
$ Typepage = $ this-> GetOneTypeUrl ($ typeinfos );
$ Typelink = "". $ typeinfos ['typename']. "";
Return $ typelink;
}


Function 2: obtain a link list for a category, such as 'Category 1> Category 2>.

The code is as follows:


// Islink indicates whether the returned list is connected.
// + The delimiter for the position of the SplitSymbol column. the default value of dede is '-'
Function GetPositionLink ($ islink = true)
{// + Get the home page link name
$ Indexpage = "indexUrl." '> ". $ this-> indexName ."";
......
......
Else
{
If ($ islink)
{
$ This-> valuePosition = $ this-> GetOneTypeLink ($ this-> TypeInfos );
If ($ this-> TypeInfos ['reid']! = 0)
{
// Call 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)
{
// Call recursive logic
$ This-> LogicGetPosition ($ this-> TypeInfos ['Reid '], false );
}
Return $ this-> valuePositionName;
}
}
}
// Obtain the link list of a specific type of object, in the recursive logic section
Function LogicGetPosition ($ id, $ islink)
{
$ This-> dsql-> SetQuery ("SQL query statement ");
$ Tinfos = $ this-> dsql-> GetOne ();
If ($ islink)
{// + List with connection
$ This-> valuePosition = $ this-> GetOneTypeLink ($ tinfos). $ this-> SplitSymbol. $ this-> valuePosition;
}
Else
{// + List without connection
$ This-> valuePositionName = $ tinfos ['typename']. $ this-> SplitSymbol. $ this-> valuePositionName;
}
If ($ tinfos ['Reid ']> 0)
{// + Recursion
$ This-> LogicGetPosition ($ tinfos ['reid'], $ islink );
}
}


Function 3: This function is used to obtain the category list. the advanced search function is highsearch. php.

The code is as follows:


// Hid indicates the selected category by default. 0 indicates "select category" or "unlimited Category"
// Category is a category that users can manage. 0 indicates all categories.
// Channeltype indicates the content type of the category, and 0 indicates unlimited channels.
Function GetOptionArray ($ hid = 0, $ token = 0, $ channeltype = 0, $ usersg = 0)
{
Return $ this-> GetOptionList ($ hid, $ token, $ channeltype, $ usersg );
}
Function GetOptionList ($ hid = 0, $ token = 0, $ channeltype = 0, $ usersg = 0)
{
Return $ this-> OptionArrayList;
}
// + Recursively add '-' to the lower-level category '-'
Function LogicGetOptionArray ($ id, $ step, $ response = 0)
{
}


Function 4,
// Obtain the category related to this class. This function is applied to the template tag {dede: channel} {/dede: channel }.
// $ The value of typetype is: sun subcategory self same-level top-level category

The code is as follows:


Function GetChannelList ($ typeid = 0, $ reid = 0, $ row = 8, $ typetype = 'sun', $ innertext = '',
$ Col = 1, $ tablewidth = 100, $ myinnertext = '')
{
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.