2
例如,我有這個疑問在我news.php文件:PHP和Smarty的執行
$sql = 'SELECT * FROM `news` ORDER BY `id` DESC LIMIT 0, 5';
$result = mysql_query($sql) or die("Query failed : " . mysql_error());
while ($line = mysql_fetch_assoc($result)) {
$value[] = $line;
}
// Assign this array to smarty...
$smarty->assign('news', $value);
// Display the news page through the news template
$smarty->display('news.tpl');
然而,在我news.tpl文件,我不會把{$}新聞變量。當我瀏覽news.php時,查詢是否仍然會執行,否則它會被忽略?