Home > CMS Tutorial > DEDECMS > body text

How to obtain the current column path in Dreamweaver CMS

藏色散人
Release: 2020-01-03 10:01:20
Original
1954 people have browsed it

How to obtain the current column path in Dreamweaver CMS

How to get the current column path in DreamWeaver cms?

Dreamweaver cms obtains the label call of the current column path and column name and the top column

Recommended learning: Dreamweaver cms

tag As follows:

Current:

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

Because {dede:field name='arcurl'/} this tag to obtain the path of the current page can only be used on the content page, and has no effect on the column page. Therefore, if you want to get the path and name of the current column on the column page, you must use the above tag.

To obtain the list of all column names and paths on the website, another tag must be used: {dede:channel}, and the calling method is as follows:

All columns

<ul>
{dede:channel  type=&#39;top&#39; row=&#39;11&#39;}
<li class="navbg"><a  href=&#39;[field:typelink/]&#39;>[field:typename/]</a></li>
{/dede:channel}
</ul>
Copy after login

Tutorial on how to get the label of the top-level column name of the current column on the dedeCMS website column page:

When we use and build some websites, we often encounter the need to call the top-level column name of the current column. DedeCMS defaults {dede:field name='typename' /} can get the name of the upper-level column on the current column page, instead of the top-level column name of the current column.

The following is a method to achieve this effect:

Add at the bottom of include/common.func.php:

Content comes from

When the top-level column name

function GetTopTypename($id)
{
    global $dsql;
     $row = $dsql->GetOne("SELECT typename,topid FROM jiemou_arctype WHERE id=  $id");
    if ($row[&#39;topid&#39;] == &#39;0&#39;)
    {
        return  $row[&#39;typename&#39;];
    }
    else
    {
        $row1 =  $dsql->GetOne("SELECT typename FROM jiemou_arctype WHERE id=  $row[topid]");
        return $row1[&#39;typename&#39;];
    }
}
Copy after login

is called on the article page or column list page, add the following line of code to the position of the column name to be called. The content comes from

{dede:field name=&#39;typeid&#39; function="GetTopTypename(@me)" /} 内容来自
Copy after login

Use the following method in the article page to call

Get the parent column of the current column

Write it as a function and put it in the include/extend.func.php file中

function GetParentCategoryNameByID($CurrentID){
$tsql = new DedeSql(false); 
$typelink2 = &#39;&#39;;
$tsql->SetQuery("Select i.typedir,i.typename From zz5unet_arctype t left join zz5unet_arctype i on i.id=t.reid where t.id=&#39;$CurrentID&#39;");
$tsql->Execute(&#39;t&#39;);   
while($row = $tsql->GetArray(&#39;t&#39;,MYSQL_ASSOC))  
{
$typelink2 .= $row[&#39;typename&#39;];  
}
return $typelink2;
}
Copy after login

Calling method: {dede:field name='id' function='GetParentCategoryNameByID(@me)' /}

The above is the detailed content of How to obtain the current column path in Dreamweaver CMS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!