-->bootstrap.php file
Code: Select all
<?php
class bootstrap{
public $lang;
public $page;
public $action;
public $id;
public $message;
public function __construct() {
}
public function buildPage() {
if($this->page == 'home'){
require_once CONTR . 'view.php';
new view($this->lang, $this->page, $this->action, $this->id, $this->message);
}
}
}
}Code: Select all
class view extends bootstrap{
public $lang;
public $page;
public $action;
public $id;
public $message;
public function __construct($lang, $page, $action, $id, $message) {
parent::__construct();
$this->lang = $lang;
$this->page = $page;
$this->action = $action;
$this->id = $id;
$this->message = $message;
$this->showPage();
}
public function showPage() {
require_once VIEW . 'header.php';
//echo VIEW . 'header.php';
//prepare SQL statements
$page = $this->page;
$name = "name_" . $this->lang;
//SQL statement
$selectdata = mysql_query("SELECT * FROM pages WHERE $name = '$page'");
$result = mysql_fetch_array($selectdata);
//Echo content
if($result["content_$this->lang"] == NULL){
echo "Er is nog geen content hier";
} else {
echo $result["content_$this->lang"];
}
//Debugging
echo '<br>' . $this->lang;
echo '<br>' . $this->page;
echo '<br>' . $name;
echo '<br>' . $page;
require_once VIEW . 'footer.php';
}
}The showpage function does actually work when I put it in the bootstrap class, but when I put it in the view class, nothing works.
Thanks in advance!