In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
I would like to share with you the ways to get the dream weaving dedecms sub-column. I believe most people don't know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it together.
How to get the dream weaving dedecms sub-column?
Dedecms5.7 gets the label of the top-level column name
Recommended study: dream weaving cms
The following is the method to call the top-level column name:
Method 1:
{dede:field.typeid runphp='yes'} $ID = @ me; $sql = "SELECT * FROM `dede_ arctype` WHERE id=$ID"; $query = mysql_query ($sql); $row=mysql_fetch_array ($query); $relID = "$row [reid]"; if ($relID = = 0) {@ me = $row [typename];} else {$sql = "SELECT `typename` FROM `dede_ arctype` WHERE id=$relID"; $query = mysql_query ($sql); $row=mysql_fetch_array ($query); @ me = $row[ typename];} {/ dede:field.typeid}
The statement of this method is a bit long.
Method 2:
{dede:field.title runphp='yes'} list ($toptype,$sontype) = split ('/', @ me); @ me=$toptype; {/ dede:field.title}
Method 3:
{dede:field.typeid runphp='yes'} $ID= @ me; $sql = "SELECT * FROM `dede_ arctype` WHERE id=$ID"; $query = mysql_query ($sql); $row=mysql_fetch_array ($query); $relID = "$row [reid]"; $topID= "$row [topid]"; if ($relID = = 0) {@ me = $row [typename];} else {$sql = "SELECT `typename` FROM `dede_ arctype` WHERE id=$topID"; $query = mysql_query ($sql); $row=mysql_fetch_array ($query); @ me = $row [typename];} {/ me}
Method 4 (recommended):
Open include/helpers/extend.helper.php and add a function:
/ * get the name of the top column of the specified column id * * @ return string * / if (! Function_exists ('getTopChannelName') {function getTopChannelName ($id) {global $dsql; $typeinfo = $dsql- > GetOne ("SELECT * FROM `dede_ arctype` WHERE id=' {$id}'"); if ($typeinfo ['reid'] = = 0) return $typeinfo [' typename']; else return getTopChannelName ($typeinfo ['reid']);}}
Use this on the list page: {dede:field name='id' function='getTopChannelName (@ me)'/}
Use this on the content page: {dede:field name='typeid' function='getTopChannelName (@ me)'/}
The url that gets the top column is attached:
Open include/helpers/extend.helper.php and add a function:
/ * get the url * * @ return string * / if (! Function_exists ('getTopChannelUrl')) {function getTopChannelUrl ($id) {global $dsql; $typeinfo = $dsql- > GetOne ("SELECT * FROM `dede_ arctype` WHERE id=' {$id}'"); if ($typeinfo ['reid'] = = 0) return GetOneTypeUrlA ($typeinfo); else return getTopChannelUrl ($typeinfo [' reid']);}}
The usage is the same as above.
The above is how to get all the contents of the Weaving Dream dedecms sub-column. 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.