{/ dede:channel}"."/> {/ dede:channel}".">

Home >CMS Tutorial >DEDECMS >How to obtain the current column path in Dreamweaver CMS

How to obtain the current column path in Dreamweaver CMS

藏色散人
藏色散人Original
2020-01-03 10:01:202012browse

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}

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>

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;];
    }
}

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)" /} 内容来自

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;
}

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!

Statement:
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