1

View : vw_home.php

<?php echo "hello world "; ?>

Controller : home.php

 <?php
          defined('BASEPATH') OR exit('No direct script access allowed');
             class home extends CI_Controller{
                 function __construct(){
                    parent::__construct();
                  }
                 function index(){
                    $data['page_title']="WELCOME | CSB SDP";
                    $this->load->view('SideBar',$data);    
                }
           }
     }

Route :

<?php
       defined('BASEPATH') OR exit('No direct script access allowed');
           $route['default_controller'] = 'home/index';
 ?>

_I guess the model is not applicable here; I am a newbie in Codeigniter and it turns out to have an error

OBJECT NOT FOUND .

can anyone please help me :( what else lack here ?

3
  • what the line of that code does the error point to ? Commented May 2, 2016 at 8:27
  • Please post full error log detail. Commented May 2, 2016 at 8:37
  • First letter of class and file name must be upper case only. In Ci3 versions. As explained here codeigniter.com/user_guide/general/… Commented May 2, 2016 at 9:38

2 Answers 2

1

You need to first letter of file and class name capital your home.php should be Home.php

and

  class home extends CI_Controller{

should

  class Home extends CI_Controller{
Sign up to request clarification or add additional context in comments.

Comments

0

Change the $route['default_controller'] from

$route['default_controller']='home\index'

to

$route['default_controller']='home'

because it is finding the controler index inside the home folder.

1 Comment

accept this as an answer if this will satisfy you as solution on your problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.