Moved content.php to includes dir, created a 404-page and a last resort to a default page (404)

This commit is contained in:
2014-06-30 19:55:06 +02:00
parent c29b964215
commit bbccef275e
4 changed files with 20 additions and 3 deletions

36
includes/content.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
class Page
{
public $name, $filename;
public static $contentFolder = "content/";
public function __construct($name, $filename)
{
$this->name = $name;
$this->filename = $filename;
}
public function createMenuItem()
{
// Match just the name, without the .html, .php etc part
preg_match_all("/[a-z_\-0-9]*/i", $this->filename, $out);
$bareFilename = $out[0][0];
// Print the menu item
print ("<li class=\"link\"><a href=\"index.php?content={$bareFilename}\">" .
$this->name . "</a></li>\n");
}
public function getFile()
{
return $this->filename;
}
// For future-uses...
public function getName()
{
return $this->name;
}
}
?>