类为我的博客显示不同的视图。
class SB_Display {
public function __contruct() {
include_once('settings/db.settings.php');
$mysqli = new mysqli($SB_dbsettings['host'],$SB_dbsettings['user'],$SB_dbsettings['pass'],$SB_dbsettings['dbname']);
}
private function List_Display() {
$VIEW = '';
include_once('views/list.html.view.php');
$sql = "SELECT * FROM sb_posts ORDER BY ID DESC LIMIT '$SETTINGS->maxposts'";
$sql = $mysqli->real_escape_string($sql);
$res = $mysqli->mysqli_query($sql);
if($res->numrows > 0) {
$res->data_seek(0);
while ($row = $res->fetch_assoc()) {
foreach($row as $key => $value) {
$BLOG->$key = $value;
$VIEW .= $HTML;
}
}
} else {
$VIEW .= 'No Posts To Display';
}
return $VIEW;
}
private function Single_Display($id) {
$VIEW = '';
include_once('views/single.html.view.php');
$sql = "SELECT * FROM sb_posts WHERE BID = '$id'";
$sql = $mysqli->real_escape_string($sql);
$res = $mysqli->mysqli_query($sql);
$row = $res->fetch_assoc();
foreach($row as $key => $value) {
$BLOG->$key = $value;
}
$VIEW .= $HTML;
return $VIEW;
}
private function Create_Display() {
include_once('views/create.html.view.php');
return $HTML;
}
private function Edit_Display($id) {
$VIEW = '';
$sql = "SELECT * FROM sb_posts WHERE BID = '$id'";
$sql = $mysqli->real_escape_string($sql);
$res = $mysqli->mysqli_query($sql);
$row = $res->fetch_assoc();
foreach($row as $key => $value) {
$BLOG->$key = $value;
}
$BLOG->id = $id;
$VIEW .= $HTML;
return $VIEW;
}
public function SB_Get_Display($type,$id) {
switch($type) {
case 'list':
$this->content = List_Display();
return $this;
break;
case 'single':
$this->content = Single_Display($id);
return $this;
break;
case 'create':
$this->content = Create_Display();
return $this;
break;
case 'edit':
$this->content = Edit_display($id);
return $this;
break;
}
}
}
以下列方式使用此类时..
$BODY = new SB_Display();
$BODY->SB_Get_Display('list','');
我收到此错误:
致命错误:调用未定义的函数 List_Display()
我不知道为什么。任何帮助将不胜感激。