ollowing sample using associative array at smarty:

Create a file named “test.php” enter following code:

01
<?php
02
require
'Smarty/libs/Smarty.class.php'
;
03
04
$smarty
=
new
Smarty;
05
06
$smarty
->assign(
'title'
,
'Contact Detail'
);
07
$smarty
->assign(
'contact'
,
array
(
'id'
=>1,
08
 
'name'
=>
'Wiwit'
,
09
 
'email'
=>
'wsiswoutomo at yahoo dot com'
,
10
 
'phone'
=>
'123456789'
11
 
));
12
$smarty
->display(
'test.tpl'
);
13
?>

Next, build template by create a file named “test.tpl” within template. Enter following code

01
<html>
02
 
<head>
03
 
<title>{
$title
}</title>
04
 
</head>
05
 
<body>
06
 
id : {
$contact
.id} <br>
07
 
name : {
$contact
.name} <br>
08
 
email : {
$contact
.email} <br>
09
 
phone : {
$contact
.phone} <br>
10
 
</body>
Tagged with:
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Set your Twitter account name in your settings to use the TwitterBar Section.