{/ dede:channel}"."/> {/ dede:channel}".">
Home >CMS Tutorial >DEDECMS >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='top' row='11'} <li class="navbg"><a href='[field:typelink/]'>[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['topid'] == '0') { return $row['typename']; } else { $row1 = $dsql->GetOne("SELECT typename FROM jiemou_arctype WHERE id= $row[topid]"); return $row1['typename']; } }
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='typeid' 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 = ''; $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->Execute('t'); while($row = $tsql->GetArray('t',MYSQL_ASSOC)) { $typelink2 .= $row['typename']; } 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!