0
這裏使用框架是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錯誤 – 2010-09-07 12:28:15
或打開PHP錯誤報告:'error_reporting(E_ALL);' – 2010-09-07 12:28:56
避免使用框架的誘惑。這總是一個糟糕的主意。框架是過去的一個不推薦的想法:未來的HTML版本可能不會再有框架了(雖然'