dedecmsHow to call the current column ID and the current column top-level ID?
{dede:type}[field:typename /]The example in this article describes how dedecms calls the current column ID and The method of the current column's top-level ID. Share it with everyone for your reference. The specific analysis is as follows:
Recommended learning: 梦Weavercms
1. The method of using dedecms to obtain the current column ID is as follows:
1. Template The following method is used to call the column ID:
The code is as follows:
{dede:type}[field:ID /]{/dede:type}
2. If the current column ID is called in {dede:sql}, the calling method is as follows:
The code is as follows:
{dede:sql sql='Select * from dede_arctype where id = ~typeid~ '} [field:字段] {/dede:sql}
2. Call the top column ID of the current column:
First, add this tag syntax
where you need to call the top column ID The code is as follows:
{dede:type}[feild:topid/]{/dede:type}
Second, modify the source file, find type.lib.php in the taglib directory under the include directory, and find this statement:
The code is as follows:
$row = $dsql->GetOne("Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `dede_arctype` where id='$typeid' ");
Modify to:
The code is as follows:
$row = $dsql->GetOne("Select id,topid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `dede_arctype` where id='$typeid' ");
Add the next line in if(!is_array($row)) return ";Add:
The code is as follows:
if( $row['topid']==0){$row['topid']=$row['id'];}{dede:type} [field:typename /]{/dede:type}
The above is the detailed content of How does dedecms call the current column ID and the current column top ID?. For more information, please follow other related articles on the PHP Chinese website!