Home >Backend Development >PHP Tutorial >Smarty area loop method in php_PHP tutorial
This article describes the method of looping smarty areas in php. Share it with everyone for your reference. The specific implementation method is as follows:
3
4
7
8
11
12
13
|
|
1 2 3 4 5 6 7 | <🎜>require 'libs/Smarty.class.php'; //Contains Smarty class library files<🎜> <🎜>$smarty = new Smarty; //Create a new Smarty object<🎜> <🎜>$array1 = array(1 => "Simon", 2 => "Elaine", 3 => "Susan"); //Define array $smarty->assign("array1",$array1); //Assign values to variables in the template $smarty->display('test3.htm'); //Display page ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
1 2 3 4 5 6 7 | <🎜>require 'libs/Smarty.class.php'; //Contains Smarty class library files<🎜> <🎜>$smarty = new Smarty; //Create a new Smarty object<🎜> <🎜>$array1 = array(0 => "Simon", 1 => "Elaine", 2 => "Susan"); //Define array<🎜> <🎜>$smarty->assign("array1",$array1); //Assign values to variables in the template $smarty->display('test10.htm'); //Display page ?> |