diff options
Diffstat (limited to 'meta.php')
| -rw-r--r-- | meta.php | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/meta.php b/meta.php new file mode 100644 index 0000000..1ed3d40 --- /dev/null +++ b/meta.php @@ -0,0 +1,99 @@ +<?php + +# this script perhaps doesn't have the most apt name, but it made sense +# to me at the time I first named it. +# the purpose of this file is to allow adding custom <head> +# items based on the current script/page. there is a common set of +# headers that will be the same for all pages and these are defined +# in the variable $commonHeaders. for example, some pages will need +# some special javascript, but we may not want to add the overhead +# of loading the javascript into pages that don't require it. this +# can be handled here. we may also be able to add page-specific +# <title>'s. at the stage that this script is included we should +# have access to all the $config variables and the database, as well +# as any user submitted data: $_POST, $_GET, etc. + +# headers common to every page +$commonHeaders = <<<HEADERS + <title>Nutrition Database</title> + <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> + <meta name='keywords' content='Nutrition, Database, Food Diary, Food Content' /> + <meta name='description' content='Food content/nutrition database.' /> + <link rel='stylesheet' media='all' type='text/css' href='{$config->_cssUri}/site.css' /> + <link rel='stylesheet' media='all' type='text/css' href='{$config->_cssUri}/2ColumnLayout.css' title='2Column' /> + <script type='text/javascript' src='{$config->_jsUri}/site.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/standard.js'></script> + +HEADERS; + +# add the generated XAJAX javascript to the headers +$commonHeaders .= str_replace("&", "&", $xajax->getJavascript($config->_jsUri)); + +switch ( $config->_thisScript ) { + + case "view_food.php": + $myHeaders = <<<HEADERS + + <link href='{$config->_jsUri}/jscalendar/calendar-system.css' type='text/css' rel='stylesheet' /> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/lang/calendar-en.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar-setup.js'></script> +$commonHeaders + +HEADERS; + break; + + case "view_meal.php": + $myHeaders = <<<HEADERS + + <link href='{$config->_jsUri}/jscalendar/calendar-system.css' type='text/css' rel='stylesheet' /> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/lang/calendar-en.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar-setup.js'></script> +$commonHeaders + +HEADERS; + break; + + case "view_diary.php": + $myHeaders = <<<HEADERS + + <link href='{$config->_jsUri}/jscalendar/calendar-system.css' type='text/css' rel='stylesheet' /> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/lang/calendar-en.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar-setup.js'></script> +$commonHeaders + +HEADERS; + break; + + case "register.php": + $myHeaders = <<<HEADERS + + <link href='{$config->_jsUri}/jscalendar/calendar-system.css' type='text/css' rel='stylesheet' /> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/lang/calendar-en.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar-setup.js'></script> +$commonHeaders + +HEADERS; + break; + + case "edit_account.php": + $myHeaders = <<<HEADERS + + <link href='{$config->_jsUri}/jscalendar/calendar-system.css' type='text/css' rel='stylesheet' /> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/lang/calendar-en.js'></script> + <script type='text/javascript' src='{$config->_jsUri}/jscalendar/calendar-setup.js'></script> +$commonHeaders + +HEADERS; + break; + + default: + $myHeaders = $commonHeaders; + +} + +?> |
