Ошибка следующая:
Код: Выделить всё
Severity: Notice
Message: Undefined property: How_can_we_help::$Content_model
Filename: controllers/how_can_we_help.php
Line Number: 14
Код: Выделить всё
class How_can_we_help extends CI_Controller
{
public function index()
{
//subcategory of page
$data = array(
'subcategory' => 'how_can_we_help',
);
//Get data from content table where subcategory = subcategory
$data['pagecontent'] = $this->Content_model->getContent($data);
//inserts "how_can_we_help" view into template
$data['main_content'] = 'how_can_we_help';
$this->load->view('includes/template', $data);
}
}
Модель:
Код: Выделить всё
class Content_model extends CI_Model
{
function getContent($data)
{
$this->db->select('category, subcategory, title, intro, content, tags');
$this->db->from('content');
$this->db->where($data);
$query = $this->db->get();
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
}
}
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/793 ... er-control
Мобильная версия