【发布时间】:2010-09-07 12:25:17
【问题描述】:
这是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 文件但仍然得到相同的结果。 谁能帮忙。
谢谢
【问题讨论】:
-
查看 php 错误日志。空页 = php 错误
-
或开启 PHP 错误报告:
error_reporting(E_ALL); -
避免使用框架的诱惑。这总是一个坏主意。框架在过去是一个被弃用的想法:未来的 HTML 版本可能不再有框架(尽管
<iframe>s 略有不同)。 -
我是新手..如果我不使用框架我该怎么办
-
@Pekka 我在哪里添加此行以打开 php 错误报告