From 0720091ca73b9714aab2b38c3682c15a0cbd4533 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Thu, 2 Jun 2011 17:20:54 -0700 Subject: Added pages --- htdocs/page.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 htdocs/page.php (limited to 'htdocs/page.php') diff --git a/htdocs/page.php b/htdocs/page.php new file mode 100644 index 0000000..e843229 --- /dev/null +++ b/htdocs/page.php @@ -0,0 +1,44 @@ + + * + */ + +require_once "src/base.inc.php"; + +require_once "src/header.inc.php"; + + +// Make sure we had a path info +if (!isset($_SERVER['PATH_INFO'])) { + errorNotFound(); +} + +// Clean up the id in the path info. +$id = substr($_SERVER['PATH_INFO'], 1, strpos($_SERVER['PATH_INFO'], '.') - 1); + +// Get the Page. +$page = Page::getByUrl($id); + +if (!$page) { + errorNotFound(); +} + +// Display the page. + +echo $page->getContent(); + +require_once "src/footer.inc.php"; + +function errorNotFound() { + // TODO: Better 404 error + echo "404"; + exit; +} + +?> + -- cgit v1.2.3