The method of smarty region loop in php, phpsmarty region loop _ PHP Tutorial

Source: Internet
Author: User
In php, the smarty region loop method is called phpsmarty region loop. The method of smarty region loop in php. the example in this article describes the method of smarty region loop in php. Share it with you for your reference. The specific implementation method is as follows: The smarty area loop method in html php, and the phpsmarty area loop

This article describes how to cycle the smarty area in php. Share it with you for your reference. The specific implementation method is as follows:

        Smarty Test           
 
 
  
         {foreach key=key1 item=item1 from=$array1}       
  
   {/foreach} 
  
{$key1} {$item1}
<? Php require 'libs/Smarty. class. php '; // contains the Smarty class library file $ smarty = new Smarty; // creates a new Smarty object $ array1 = array (1 => "Simon ", 2 => "elasticity", 3 => "Susan"); // defines the array $ smarty-> assign ("array1", $ array1 ); // assign a value to the variable $ smarty-> display('test3.htm') in the template; // display the page?>

Another method:

        Smarty Test           
          
 
 
 
  
         {section name=section1 loop=$array1}       
  
   {/section} 
  
{$array1[section1]}
<? Php require 'libs/Smarty. class. php '; // contains the Smarty class library file $ smarty = new Smarty; // creates a new Smarty object $ array1 = array (0 => "Simon ", 1 => "elasticity", 2 => "Susan"); // defines the array $ smarty-> assign ("array1", $ array1 ); // assign a value to the variable $ smarty-> display('test10.htm') in the template; // display the page?>

I hope this article will help you with php programming.

Examples in this article describes how to cycle the smarty area in php. Share it with you for your reference. The specific implementation method is as follows: html...

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.