Skip to content

Instantly share code, notes, and snippets.

@heinrich5991
Forked from FT45/config.php
Created December 14, 2010 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heinrich5991/741146 to your computer and use it in GitHub Desktop.
Save heinrich5991/741146 to your computer and use it in GitHub Desktop.
<?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&uuml;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