Home > CMS Tutorial > DEDECMS > How to call the top column ID on dedecms list page and content page

How to call the top column ID on dedecms list page and content page

藏色散人
Release: 2020-01-15 10:44:25
Original
2827 people have browsed it

How to call the top column ID on dedecms list page and content page

dedecms list page and content page how to call the top column ID?

dedecms list page and content page call the top level Column ID method

Recommended learning: 梦Weaving cms

Summary of the method of adding top column id in dede dreamweaving template, using dede top column id can achieve many functions For example: calling different column images on each list page (the same top-level column calls the same image), if we make N columns, it means making N list page templates, and this method is not advisable;

So how can we deal with this problem faster and easier? The idea of ​​dede template is as follows: call the top column ID, and then add the end of the picture as the ID number, such as: img1.jpg, which is imgID.jpg. We just need to make pictures; that’s what it means. The following is the method collected by Dream Weaver on the Internet:

dede calls the top column ID. Method one:

{dede:field.typeid function="GetTopid(@me)"/}
Copy after login

Dreamweaver recommends this method, and it is feasible after testing

dede calls the top column ID Method 2:

First, where Where you need to call the top-level column ID, add this tag syntax

{dede:type}[feild:topid/]{/dede:type}
Copy after login

Second, modify the source file and find type.lib.php in the taglib directory under the include directory.

Find this statement

$row = $dsql->GetOne(“Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
From `dede_arctype` where id=’$typeid’ “);
Copy after login

Modify it to

$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

if( $row['topid']==0){$row['topid']=$row['id'];}
Copy after login

like this in the next line of if(!is_array($row)) return ”; , this statement can be called in either the top-level column or a sub-column.

The above is the detailed content of How to call the top column ID on dedecms list page and content page. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template