Zblog php calls the latest article, popular clicks, and comment on the article code at most

Source: Internet
Author: User
Tags foreach php template
Today, no matter how we set up personal blogs, corporate websites, or even big data content websites, we basically don't need to re-write our own programs. After all, there are many free and open-source CMS programs available on the Internet. CMS commonly used by Lao Jiang includes WordPress, which is suitable for content and custom websites that are slightly more automated. For example, the Lao Jiang tribe adopts this CMS and uses more zblog php programs, after the PHP version is automatically available, the usage is high, because currently there are many Linux virtual hosts and VPS hosts, which are used for enterprise websites and lightweight blogs.

 

For general users, it is sufficient for us to be familiar with 1-3 open-source free applications. Basically, the kernel does not need to be defined and changed by ourselves. We only need to sort out the commonly used call code, you can call the template directly later. In this article, Lao Jiang will sort out the list of the latest articles called during zblog php template creation, filtered by clicks and comments.

 

First, the latest article

 

The code is as follows: Copy code

{Foreach GetList (8) as $ newlist}
<Li> <a href = "{$ newlist. url} "title =" {$ newlist. title} "> {$ newlist. title} </a> <span >{$ newlist. time ('M-D')} </span> </li>
{/Foreach}

 

Call the latest 8 articles.

 

2. Call clicks

 

The code is as follows: Copy code

{Php}
$ Order = array ('log _ viewnums' => 'desc ');
$ Where = array ('=', 'log _ status', '0 '));
$ Array = $ zbp-> GetArticleList (array ('*'), $ where, $ order, array (8 ),'');
{/Php}
{Foreach $ array as $ hotlist}
<Li> <span> {$ hotlist. viewNums} Times </span> <a href = "{$ hotlist. url} "title =" {$ hotlist. title} "> {$ hotlist. title} </a> </li>
{/Foreach}

 

Sort the number of clicks/readings in an article. You can call up to eight articles.

 

Third, comment on articles at most

 

The code is as follows: Copy code

{Php}
$ Order = array ('log _ commnums' => 'desc ');
$ Where = array ('=', 'log _ status', '0 '));
$ Array = $ zbp-> GetArticleList (array ('*'), $ where, $ order, array (8 ),'');
{/Php}
{Foreach $ array as $ hotlist}
<Li> <span> {$ hotlist. commNums} comment </span> <a href = "{$ hotlist. url} "title =" {$ hotlist. title} "> {$ hotlist. title} </a> </li>
{/Foreach}

 

Call 8 articles based on comment data.

 

In summary, I usually use more of the above three calls, which can be used when creating themes.

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.