[英]How to use frames in smarty
这是PHP文件
<?php
require_once ('lib/config.inc.php');
require_once ('lib/smarty.php');
require_once ('lib/DataBase.php');
$n="shaz";
$p="pwd";
//Data Retrieving
$db = new DataBaseReader(DB_HOST, DB_NAME, DB_USER, DB_PASS);
try{
$db->connect();
$user = $db->login($n,$p);
if($user=="false")
echo "no login" ;
else
{ echo $user;
$_SESSION['sessUser']=$user;
}
}
catch(Exception $e){
echo "Exception: " . $e;
}
$db->disconnect(); //finally!!!
$smarty = new MyDir_Smarty();
$smarty->assign('user_type',$user);
$smarty->display('result.html');
mysql_close();
?>
这是result.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
{$user_type}
<frameset rows="80,*" frameborder="no" border="0" framespacing="0">
<frame src="topFrame.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frame src="mainFrame.html" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>
如果我在服务器上运行html文件,它可以正常工作,但是当我尝试使用smarty显示它时,我得到了一个空白页。 我尝试将其保存为php,但仍然无法正常工作。尝试将其保存为.tpl文件,但仍得到相同的结果。 谁能帮忙。
谢谢
似乎缺少身体标签。
尝试这个:
<body>
{$user_type}
<frameset rows="80,*" frameborder="no" border="0" framespacing="0">
<frame src="topFrame.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frame src="mainFrame.html" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes></noframes>
</body>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.