Examples of popular articles in zblog php this week, this month, and this year without plug-ins

Source: Internet
Author: User
Tags foreach
Generally, we use the latest articles, clicks, and comments when calling zblog php articles (the method is here ), at the same time, we may also call popular articles this week, this month, and this year in some specific locations. As a coincidence, when I made a theme for an enterprise website customer, there was an empty position on the side and I didn't know what to put, so I called him the popular product content of the year. For more information, see @ Tianxing.

 

The code is as follows: Copy code

{Php} $ stime = time ();
$ Ytime = 90* 24*60*60;
$ Ztime = $ stime-$ ytime;
$ Order = array ('log _ viewnums' => 'desc ');
$ Where = array ('=', 'log _ status', '0'), array ('>', 'log _ posttime', $ ztime ));
$ Array = $ zbp-> GetArticleList (array ('*'), $ where, $ order, array ( 10),'');
{/Php}
{Foreach $ array as $ cmslist}
<Li> <a href = "{$ cmslist. Url}" title = "{$ cmslist. Title}" >{$ cmslist. Title} </a> </li>
{/Foreach}

 

For specific parameters, we can see 90 and 10 in the above script. The former represents the call of 10 popular articles in 90 days. If it takes 7 or 365 days, modify the number accordingly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.