Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 3.1.7 News Tutorial ERROR
#1

(This post was last modified: 02-01-2018, 12:51 PM by InsiteFX.)

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 )
Reply
#2

(02-01-2018, 12:41 PM)InsiteFX Wrote: // WRONG!
               $this->load->helper('url_helper');

// Should be...
               $this->load->helper('url');

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...
 

Good Catch!!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB