From d895b852a6e160496ffc760d46d3719a3d62ff86 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sun, 3 Feb 2008 23:23:24 +0000 Subject: Initial checkin of nutridb.org and basic subversion directory structure --- header.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 header.php (limited to 'header.php') diff --git a/header.php b/header.php new file mode 100644 index 0000000..8219f04 --- /dev/null +++ b/header.php @@ -0,0 +1,36 @@ + tags for any given file, while still using +# a common header file +include("meta.php"); +$smarty->assign("myHeaders", $myHeaders); + +# if logged in show logout, if not, show login fields. this +# variable will also be used as a convenient way for the +# templates to identify if a user is logged in or not and to +# show or not show certain things +if ( isLoggedIn() ) { + $smarty->assign("isLoggedIn", true); + + # get any saved foods the user may have + $smarty->assign("favFoods", getFavoriteFoods($_SESSION['user']['id'])); + + # get any saved meals the user may have + $smarty->assign("favMeals", getFavoriteMeals($_SESSION['user']['id'])); + + # get any saved diaries the user may have + $smarty->assign("userDiaries", getUserDiaries($_SESSION['user']['id'])); + +} + +# print any system message that may exist and then clear the variable +if ( ! empty($_SESSION['systemMsg']) ) { + $smarty->assign("systemMsg", $_SESSION['systemMsg']); + unset($_SESSION['systemMsg']); +} + +# grab the header +$smarty->assign("header", $smarty->fetch("header.tpl")); + +?> -- cgit v1.2.3