In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to access the articles recently updated by phpcms. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.
How does phpcms access the most recently updated articles?
Phpcms v9 calls the latest articles on the site (update everything recently)
The first step is to modify phpcms\ modules\ content\ classes content_tag.class.php to add to the last}
Public function newcontent ($data) {$num = intval ($data ['limit'])? Intval ($data ['limit']):' 20ranking / setting sort switch ($data ['order']) {case' 1':$order = '`id`ASC'; break;case '2':$order =' `id`DESC'; break;case '3':$order =' `inputtime`ASC'; break;case '4':$order =' `inputtime`DESC'; break;case '5':$order =' `updatetime` ASC'; break;case '6':$order =' `updatetime`DESC'; break;default:$order = '`id`DESC' } if ($data ['catid']) {$catids = explode (',', $data ['catid']); foreach ($catids as $catid) {$catid = intval ($catid); if (empty ($catid)) continue;$this- > set_modelid ($catid); $where = $this- > category [$catid] [' child']? `catid`IN ('. $this- > category [$catid] ['arrchildid'].')': "`catid` = $catid"; $datas = $this- > db- > select ($where,'*', $num, $num) $data [$catid] ['data'] = $datas;// record the number of articles $data [' num'] [] = count ($datas); $model_num++;}} else {$models = getcache ('model',' commons'); foreach ($models as $model) {$this- > db- > set_model ($model ['modelid']); $datas = $this- > db- > select ('','*', $num, $order); $data [$model ['modelid']] [' data'] = $datas / / record the number of articles this time $data ['num'] [] = count ($datas); $model_num++;}} if ($data) {/ / get the number of entries that should be intercepted by each model $num = ceil ($num/$model_num); / / the number of loops is used to find out the number of articles that are not satisfied and then average $w_num = $w_num_t ='' Foreach ($data ['num'] as $num_t) {if ($num_t < $num) {$w_num + = $num-$num_t;$w_num_t++;}} / / determine if there is anything that does not meet the average, then increase the average if ($w_num_t) {$num + = ceil ($w_num/ ($model_num-$w_num_t));} $datas = array (); foreach ($data as $r) {$rnsn ='' If (is_array ($r ['data']) foreach ($r [' data'] as $rystt) {$datas [] = $rattlesif (+ + $rattn = = $num) break;}} return $datas;} else {return false;}}
Step 2: template call
In fact, it is similar to the default article list call.
{pc:content action= "newcontent"}
Parameter description:
Catid: if you don't need to add it, just call the information of the specified column. For multiple columns, please use the English half-corner, interval.
Order: sort parameter value: 1-7 the specific meaning is easy to read in the code.
Num: the number of calls does not specify 20 calls by default
After reading the above, do you have any further understanding of how to access the recently updated articles from phpcms? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.