From bb371da4ba05e12fd548fed282646ecbd86b5c1d Mon Sep 17 00:00:00 2001 From: Denis Walker <dez@sucs.org> Date: Mon, 26 Nov 2007 19:44:08 +0000 Subject: [PATCH] Forces Smarty $news variable not to exist if there are no news items --- components/news.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/news.php b/components/news.php index 6f7c8f4..8c6631e 100644 --- a/components/news.php +++ b/components/news.php @@ -41,7 +41,8 @@ $query = "SELECT *, date_part('epoch', expiry) AS expirytime FROM news"; if (@$pathlist[2]!="") $query .= " WHERE title=".$DB->qstr($pathlist[2]); $query .= " ORDER BY date DESC"; -$smarty->assign("news", $DB->GetArray($query)); +$newsarray = $DB->GetArray($query); +if (!empty($newsarray)) $smarty->assign("news", $newsarray); $output = $smarty->fetch("news.tpl"); $smarty->assign("title", "News"); -- GitLab