Display php Variable on Smarty Template 3 -
i've been trying display php variable on smarty template, have been impossible.
on tpl have:
<a href="#">welcome <strong><!--{$username}--></strong></a> on php have:
<?php require('../common/smarty/config.php'); //smarty config class require_once('../common/config/config.php'); //project config class require_once('../common/classes/login.php'); //login class $smarty = new smarty(); $template = "login.tpl"; $smarty->assign ( "username", $user_name ); //first: smarty variable, last: php variable. $smarty->display ( "{$template}" ); ?> what im trying display username of user @ login page.
any help?
thanks in advance.
in smarty lib tpl should write {$username} want user name appear in login.tpl file.
change this
<a href="#">welcome <strong><!--{$username}-->``</strong></a> to this
<a href="#">welcome <strong>{$username}</strong></a> the above works me
Comments
Post a Comment