Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of selecting the same-level column when there is no sub-column in dedecms

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

This article mainly introduces the method of taking the same-level column when there is no sub-column in dedecms. The introduction in the article is very detailed and has a certain reference value. Interested friends must read it!

{dede:channel type='son'} in dedecms, how to get a peer column when there is no sub-column?

Let's first show you a piece of code:

{dede:channelartlist typeid = 3} {dede:field name='typename'/} {dede:channel type='son' noself='yes'} [field:typename/] {/ dede:channel} {/ dede:channelartlist}

This code means to query the sub-column of id 3 and then query the sub-column of the query sub-column. The effect is shown in the figure:

But this will give rise to a problem, that is, if the column does not have a sub-column, it will take its peer column, so how to solve the problem of {dede:channel type='son'} taking the same-level column when there is no sub-column?

It's actually very simple:

Open the: include\ taglib\ channel.lib.php file.

find

If ($type=='son' & & $reidentices0 & & $totalRow==0)

Change to

If ($type=='son' & & $reidentices0 & & $totalRow==0 & & $noself=='')

That's right.

The above are all the contents of the method of taking the same level column when there is no sub-column in dedecms. Thank you for your reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Columns siblings childless methods code content questions queries right value interest guys buddies that is meaning effects files more knowledge articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information Apple NVidia OPPO Reno