Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report