Home  >  Article  >  CMS Tutorial  >  How does dedecms call the current column ID and the current column top ID?

How does dedecms call the current column ID and the current column top ID?

藏色散人
藏色散人Original
2019-12-18 09:46:161829browse

How does dedecms call the current column ID and the current column top ID?

dedecmsHow to call the current column ID and the current column top-level ID?

{dede:type}5c236d824c0f85f9ae4462a3c540f3aa[field:typename /]5db79b134e9f6b82c0b36e0489ee08edThe 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!

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