Blogroll

photoshop cs6 html 5 css php seo backlinks

adsense

Monday, 24 February 2014

Use of Array Index : Smarty Variable

Smarty Variable Step by Step Tutorial - Part 2: Following sample using array indexed at smarty:
Create a file named "test.php" enter following code:
1<?php
2require 'Smarty/libs/Smarty.class.php';
3 
4$smarty = new Smarty;
5 
6$smarty->assign('title','Contact Detail');
7$smarty->assign('contact',array(1,'Wiwit','wsiswoutomo at yahoo dot com','123456789'));
8$smarty->display('test.tpl');
9?>
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[0]} <br>
07    name : {$contact[1]} <br>   
08    email : {$contact[2]} <br>   
09    phone : {$contact[3]} <br>   
10  </body>
11</html>

0 comments:

Post a Comment