-
-
Save heinrich5991/741146 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class page { | |
public function show($page='', $id='') { | |
// Variable '$page' wird gespeichert. | |
if($page == ''): | |
$this->page = 'index' | |
else: | |
$this->page = $page; | |
endif; | |
// Variable '$id' wird gespeichert. | |
$this->id = $id; | |
// Variable '$file' wird gespeichert. | |
$this->file = PAGE_PATH . '/' . $this->page . '.php'; | |
// Überprüfen, ob eine Datei mit dem Pfad und Namen: '$file' existiert. | |
if(file_exists($this->file)): | |
// Überprüfen, ob diese Datei lesbar ist. | |
if(is_readable($this->file)): | |
$this->get_meta($this->page); | |
echo '<head>'; | |
include_once('head.php'); | |
echo '</head>'; | |
echo '<body>'; | |
include_once($this->file); | |
echo '</body>'; | |
else: | |
echo '<p><b>Der Inhalt der Datei: ´' . $this->page . '.php´ aus dem Pfad: ´ '. PAGE_PATH .' ´ konnte nicht gelesen werden.</b></p>'; | |
endif; | |
else: | |
echo '<p><b>Sie haben einen ungültigen oder falschen Link aufgerufen.</b></p>'; | |
endif; | |
} | |
public function get_meta($page) { | |
$result = mysql_query("SELECT * FROM page WHERE _title = '$page'"); | |
if(mysql_num_rows($this->result) != 0): | |
$row = mysql_fetch_array($result); | |
$this->title = $row['title']; | |
$this->description = $row['description']; | |
$this->author = $>row['author']; | |
$this->charset = $row['charset']; | |
else: | |
$this->title = 'Error!'; | |
$this->description = 'Error!'; | |
$this->author = 'Teeworlds.de'; | |
$this->charset = 'utf-8'; | |
endif; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment