Get the App
SLTechnology News&Howtos  ›  Servers  › 

What are the methods for dedecms list pages and content pages to call top-level column ID

Shulou Source: shulou.com Published: 2022-06-02 05:34:16 10月02日 Update

Editor to share with you about the dedecms list page and content page to call the top column ID methods, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

How do dedecms list pages and content pages call the top-level column ID?

Summary of the method of adding top-level column id to dede dream weaving template. Using dede top-level column id can achieve many functions, such as: calling different column pictures in each list page (the same top-level column calls the same picture). If we do N columns, it means doing N list page templates, showing that this method is not desirable.

So how can we deal with this problem more quickly and easily? the idea of the dede template is as follows: call the top column ID, and then add the end of the image to the ID number, such as: img1.jpg is imgID.jpg, so we just need to make the image. That's what it means. Here are the methods collected by the dream weaver on the network:

Dede calls the top-level column ID method 1:

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

The dream weaver first recommended this method, which has been tested to be feasible.

Dede calls the top-level column ID method 2:

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

{dede:type} [feild:topid/] {/ dede:type}

Second, modify the source file to find the 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,sitepathFrom `dede_ arctype` where id='$typeid'")

Modify it to

$row = $dsql- > GetOne ("Select id,topid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepathFrom `dede_ arctype` where id='$typeid'")

Add on the next line of if (! is_array ($row)) return ";

If ($row ['topid'] = = 0) {$row [' topid'] = $row ['id'];}

In this way, this statement can be called in either the top-level column or the sub-column.

The above is the dedecms list page and content page to call the top column ID method has all the content, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Column top level method content picture template catalog article sentence different feasible same one line not much function place most that is tail train of thought Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Xiaomi OPPO Reno Microsoft Shulou Technology