• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter 3.1.7 News Tutorial ERROR

#1
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.