Smarty Variable Step by Step Tutorial - Part 1: Following sample using associative array at smarty:
Create a file named "test.php" enter following code:
02 | require 'Smarty/libs/Smarty.class.php'; |
06 | $smarty->assign('title','Contact Detail'); |
07 | $smarty->assign('contact',array('id'=>1, |
09 | 'email'=>'wsiswoutomo at yahoo dot com', |
12 | $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.id} <br> |
07 | name : {$contact.name} <br> |
08 | email : {$contact.email} <br> |
09 | phone : {$contact.phone} <br> |
0 comments:
Post a Comment