This article describes how to obtain the path and name of the current topic by Zhimeng dedecms. For more information about how to obtain the path and name of the current topic by using Zhimeng decms, for more information, see
Dedecms Template: www.php1.cn/xiazai/code/dedecms
The labels are as follows:
Current:
The code is as follows:
{dede:type} [field:typename/] {/dede:type}
Because the tag {dede: field name = 'arcurl'/} used to obtain the path of the current page can only be used on the content page, and the column page has no effect. Therefore, to obtain the path and name of the current topic on the topic page, use the above label.
To obtain the list of all the column names and paths of a website, you need to use another tag: {dede: channel}. The Calling method is as follows:
All columns
The code is as follows:
{dede:channel type='top' row='11'}
- [field:typename/]
{/dede:channel}
Zhimeng dedeCMS website topic page to obtain the top-level topic name of the current topic. tutorial:
When using websites, we often encounter the need to call the top-level topic names of the current topic. the default {dede: field name = 'typename'/} can be used to obtain the name of the first-level topic on the current topic page, rather than the top-level topic name of the current topic.
Below we will expand a method to achieve this effect ,:
Add the following at the bottom of include/common. func. php:
Content from
Top-level topic 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 { $row1 = $dsql->GetOne("SELECT typename FROM jiemou_arctype WHERE id= $row[topid]"); return $row1['typename']; }}
Add the following line of code to the position of the topic name to be called on the article or topic list page. Content from
{Dede: field name = 'typeid' function = "GetTopTypename (@ me)"/} content from
On the document page, use the following method to call
Obtain the parent topic of the current topic
Write a function into the include/extend. func. php file.
The code is as follows:
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;}
Call method:
{dede:field name='id' function='GetParentCategoryNameByID(@me)' /}
The above is the details of the case for Zhimeng dedecms to obtain the path and name of the current topic. For more information, see other related articles in the first PHP community!