How to get the corresponding number of news bars according to the numbers defined in the Smarty template

Source: Internet
Author: User
Tags smarty template
How do I get the corresponding number of news bars according to the numbers defined in the Smarty template?
Just touch the smarty template, want to control the number of news displayed in the template, shown below 5 News
 
 
 

    {section name=news loop= $arr max=5}
  • {$arr [News].title}

  • {/section}



How to read the corresponding number of records in the PHP program according to the number of bars in the template? How do I get the number of bars set in my template?
Thus implementing the following SQL:
SELECT ID, title, wdate from news ORDER by ID DESC LIMIT 0, 5

Instead of:
SELECT ID, title, wdate from news ORDER by ID DESC

Share to:


------Solution--------------------
Define another variable that introduces the use of
------Solution--------------------
The Smarty cycle can be controlled and terminated, but it's not your type.

No interest in Smarty!

  • 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.