PHP Code:
<?php
class News extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('news_model');
// WRONG!
$this->load->helper('url_helper');
// Should be...
$this->load->helper('url');
}
public function index()
{
$data['news'] = $this->news_model->get_news();
}
public function view($slug = NULL)
{
$data['news_item'] = $this->news_model->get_news($slug);
}
}
I just did the complete News Tutorial using CodeIgniter 3.1.7 and PHP 7.1.2 Only thing
missing is you need to create the HTML view for the Success view...
This produces a 404 ERROR because it doe's not exists...
views/news/success.php
PHP Code:
<?php
echo '<h2>Create News Item - Success</h2>';
And it ran fine even inserting news items to the database.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )