Ошибки при выводе в cignitere. что делать? триста раз уже всё проверил?
Это контроллер News.php
<?php
defined('BASEPATH') OR exit('No direc script access allowed');
class News extends CI_Controller
{
function public__construct()
{
parrent::__construct();
$this->load->model('News_model');
}
public function index() {
$data['title'] = "Все новости";
$data['news'] = $this->News_model->getNews();(cтрока 16)
$this->load->view('tamplets/header', $data);
$this->load->view('news/index', $data);
$this->load->view('tamplets/footer');
}
}
Это модель News_model
<?php
class News_model extends CI_Model
{
public function __construct()
{
$this->load->database();
}
public function getNews($slug = FALSE)
{
if($slug === FALSE)
{
$query = $this->db->get('news');
return $query->result_array();
}
$query = $this->db->get_where('news', array('slug' => $slug));
return $query->row_array();
}
}
Ниже ошибки, которые выдает браузер.
A PHP Error was encountered
Severity: Notice
Message: Undefined property: News::$News_model
Filename: controllers/News.php
Line Number: 16
Backtrace:
File: C:\xampp\htdocs\Kinomonster\application\controllers\News.php
Line: 16
Function: _error_handler
File: C:\xampp\htdocs\Kinomonster\index.php
Line: 315
Function: require_once
2-я ошибка
An uncaught Exception was encountered
Type: Error
Message: Call to a member function getnews() on null
Filename: C:\xampp\htdocs\Kinomonster\application\controllers\News.php
Line Number: 16
Backtrace:
File: C:\xampp\htdocs\Kinomonster\index.php
Line: 315
Function: require_once