我有PHP代码:
$uid = $xUS['id']; // Current user id
$uname = $xUS['x_username']; // Current user name
$ulink = ''; // Current user profile URL (leave blank for none)
$upic = $xUS['config_forum_avator_head']; // Current user
$ismod = 0; // Is current user a moderator?
$sig = md5($uid . $uname . $ismod . 's79tvi40k95bs6mw');
$ssoParams = '&uid=' . $uid . "&uname=" .
urlencode($uname) . "&ulink=" . urlencode($ulink) . "&upic=" . urlencode($upic)
. "&ismod=" . $ismod . "&sig=" . $sig;</i>
我的Smarty模板文件:
<iframe width='550' height='500' src='http://chatroll.com/embed/chat/pibux-chatroom?id=tgybumotNmY&platform=php{$ssoParams}&w=$0' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' allowtransparency='true'></iframe>
在此,{$ssoParams}
变量返回空值。为什么?请帮忙。
答案 0 :(得分:0)
阅读Smarty文档,例如:http://www.smarty.net/docsv2/en/language.variables.tpl#language.assigned.variables
您需要指定一个变量,如:
$smarty = new Smarty();
$smarty->assign('ssoParams', $ssoParams); // assign(smarty var, PHP var);
$smarty->display('template_file.tpl');
当然,您需要包含智能文件,定义模板等。
对于基本工作示例,请查看示例2.9。这里: http://www.smarty.net/docsv2/en/installing.smarty.basic.tpl#id2778275