Home> CMS Tutorial> DEDECMS> body text

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

藏色散人
Release: 2019-12-18 09:46:16
Original
1784 people have browsed it

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}[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}
Copy after login

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}
Copy after login

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}
Copy after login

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' ");
Copy after login

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' ");
Copy after login

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}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!