In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you the phpcms home page only shows the method of designated columns, I believe that most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
How to display only specified columns on the home page of phpcms
The following code controls which columns are displayed through the column id. Id makes a background query according to the actual situation, and the subcat function explains the final attachment. The following code is modified:
{loop subcat {if $r ['catid'] = = 1 | $r [' catid'] = = 2} / / which columns are shown {php $num++} {$r} > {pc:content action= "lists" catid= "$r" order= "updatetime DESC" thumb= "1" num= "1" return= "info"} {loop $info $v}
{str_cut ($v ['title'], 28)} {str_cut ($v [' description'], 100)}
{/ loop} {/ pc} {pc:content action= "lists" catid= "$r" num= "5" order= "id DESC" return= "info"} {loop $info $v} {str_cut ($v ['title'] 40)} {/ loop} {/ pc} {if $num%2==0} {/ if} {/ if} {/ loop}
In addition to specifying specific columns, we can also use exclusion to display specific columns.
V9 method of excluding a column
{loop subcat {if $r ['catid'] = = 3} {/ if} / exclude a column {php $num++} {$r} more > {pc:content action= "lists" catid= "$r" order= "updatetime DESC" thumb= "1" num= "1" return= "info"} {loop $info $v}
{str_cut ($v ['title'], 28)} {str_cut ($v [' description'], 100)}
{/ loop} {/ pc} {pc:content action= "lists" catid= "$r" num= "5" order= "id DESC" return= "info"} {loop $info $v} {str_cut ($v ['title'] 40)} {/ loop} {/ pc} {if $num%2==0} {/ if} {/ loop}
{loop subcat (0re0re0re0remensiteid) $r} {/ loop} function explanation:
/ * * get child column * @ param $parentid parent id * @ param $type column type 1 is a single web page type, 0 is a column type (check phpcms's mysql database to see whether * @ param $self contains * @ param $siteid site id * / function subcat ($parentid = NULL,$ type = NULL,$self ='0", $siteid ='') {if (empty ($siteid)) $siteid = get_siteid (); $category = getcache ('category_content_'.$siteid,'commons') Foreach ($category as $id= > $cat) {if ($cat ['siteid'] = = $siteid & & ($parentid = NULL | | $cat [' parentid'] = = $parentid) & & ($type = NULL | | $cat ['type'] = = $type)) $subcat [$id] = $cat; if ($self = = 1 & $cat [' catid'] = = $parentid & &! $cat ['child']) $subcat [$id] = $cat;} return $subcat } above are all the contents of the phpcms home page that only shows the method of the specified column, thank you for your 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.