Smarty Variable Step by Step Tutorial - Part 2: Following sample using array indexed at smarty:
Create a file named "test.php" enter following code:
2 | require 'Smarty/libs/Smarty.class.php' ; |
6 | $smarty ->assign( 'title' , 'Contact Detail' ); |
7 | $smarty ->assign( 'contact' , array (1, 'Wiwit' , 'wsiswoutomo at yahoo dot com' , '123456789' )); |
8 | $smarty ->display( 'test.tpl' ); |
Next, build template by create a file named "test.tpl" within template. Enter following code
03 | <title>{ $title }</title> |
06 | id : { $contact [0]} <br> |
07 | name : { $contact [1]} <br> |
08 | email : { $contact [2]} <br> |
09 | phone : { $contact [3]} <br> |
0 comments:
Post a Comment