Weaving dream dedecms To obtain the current column path and column name method case

Source: Internet
Author: User
This article mainly introduces the weaving dream dedecms to obtain the current column path and column name method, the need for friends can refer to the next

Dedecms template Download Address: www.php.cn/xiazai/code/dedecms

The label is as follows:
Current:

The code is as follows:

{dede:type}<a href= "[Field:typelink  /]" > [field:typename/] </a>{/dede:type}

Because {Dede:field name= ' Arcurl '/} This gets the current page path of the label can only be used in the content page, the column page has no effect. So in the column page want to get the current column path and name, you need to use the above tag.
To get a list of all the column names and paths of the site, use another tag: {Dede:channel}, which is called as follows:
All columns

The code is as follows:

<ul>{dede:channel  type= ' top ' row= ' one '}<li class= ' navbg ' ><a href=  ' [field:typelink/] ' >[ Field:typename/]</a></li>{/dede:channel}</ul>

Weaving Dream dedecms Site page to get the current column of the top column name of the label tutorial:
When we use to do some Web site, often encounter need to call the current column of the top column name, weaving dream Default {Dede:field name= ' typename '/} can get the current column page the name of a column, not the current column top column name.
The following expands a method to achieve this effect:
At the bottom of the include/common.func.php, add:
Content from
Top Column Name

The code is as follows:

function Gettoptypename ($id) {    global $dsql;     $row = $dsql->getone ("Select Typename,topid from Jiemou_arctype WHERE id=  $id");    if ($row [' topid '] = = ' 0 ')    {        return  $row [' TypeName '];    }    else    {        $row 1 =  $dsql->getone ("Select typename from Jiemou_arctype WHERE id=  $row [Topid]");        return $row 1[' TypeName ';    }}

In the article page or column list page call, the name of the field you want to call the location with the following line of code can be implemented. Content from
{Dede:field name= ' typeid ' function= "Gettoptypename (@me)"/} content from
In the article page, the following method is used to invoke the
Get the parent column of the current column
Write a function into the include/extend.func.php file

The code is as follows:

function Getparentcategorynamebyid ($CurrentID) {$tsql = new Dedesql (false); $typelink 2 = "; $tsql->setquery (" Select I.typedir,i.typename from Zz5unet_arctype T left join Zz5unet_arctype i on I.id=t.reid where t.id= ' $CurrentID ' "); $tsql-&G T Execute (' t ');   while ($row = $tsql->getarray (' t ', MYSQL_ASSOC))  {$typelink 2. = $row [' TypeName '];  } return $typelink 2;}

Call Method:

{Dede:field name= ' id ' function= ' getparentcategorynamebyid (@me) '/}

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.