The PHP file you need to include the Smarty class
require 'Smarty.class.php'. After that you instantiate the smarty with $smarty = new Smarty. To assign a variable to the template you need to
$smarty->assign('UserName', 'Jeff Adams'). After everything is finished you call the method and to display the template $smarty->display('index.tpl').A sample code like this (index.php) :
<php
require 'Smarty.class.php'; $smarty = new Smarty; $smarty->assign('Username', 'Jeff Adams'); $smarty->display('index.tpl'); ?> The template (index.tpl) like this:
<html> <body> Welcome {$Username} body> html> Also create an array in PHP an pass it to the template:
$tmplate = array ( 'UID'=> '10', &'Name' => 'Jeff Adams', 'Address'=>'Home address'); $smarty->assign('info', $tmplate);



