About the use of popular articles in THINKCMF

Source: Internet
Author: User

Today, when you are working on a page in the news list, you have to read a large list of news items. It would be painful if each piece of data should be taken from the data according to the article ID and term_id.

Witty as I, however, found the use of popular articles in the CMF framework:

At the code level, the general wording of the article is:

1<divclass= "Tc-box" >2<divclass= "Headtitle" >34</div>5<divclass= "ranking" >6<php>7         $hot _articles=sp_sql_posts ("CID:$portal _hot_articles; field:post_title,post_excerpt,object_id,smeta,term_id;order:post_hits Desc;limit:5; "); 8</php>9<ulclass= "Unstyled" >Ten<foreachName= "Hot_articles" item= "VO" > One<php>$top=$key<3? " TOP3 ":" ";</php> A<liclass="{$top} "><i>{$key+1}</i><a title= "{$vo. Post_title} "href=" {: Leuu (' Article/index ', array (' id ' =$vo[' object_id '], ' cid ' =$vo[' term_id '])} " >{$vo.post_title}</a></li> -</foreach> -</ul> the</div> -</div>

See the default hot_articles, should be a default definition of popular articles. There's a

CID: $portal _hot_articles

Should be a well-encapsulated function. The results are as follows:

Finally, after the CID is modified, the article ID and return value are successfully obtained.

About the use of popular articles in THINKCMF

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.