Hi I’m just new in codeigniter. My website works locally, but when I uploaded it, I got this error:
An Error Was Encountered
Unable to load the requested file: home\home_view.php
Here is my controller:
<?php
class home extends CI_Controller{
function index(){
$data=array();
if($query=$this->home_model->get_dynamic_main_menu())
{
$data[‘main_menu’] = $query;
}
$this->load->view(‘home\home_view’,$data);
}
}
Thanks!
try
$this->load->view('home/home_view',$data);
(and note the " ' " not the " ‘ " that you used)
File names are case sensitive - please check your file name. it should be in same case in view folder
I error occor. When you are trying to access a file which is not in the director. Carefully check path in the view
$this->load->view('path');
default root path of view function is application/view .
I had the same error. I was trying to access files like this
$this->load->view('pages/view/file.php');
Actually I have the class Pages and function. I built the function with one argument to call the any files from the director application/view/pages . I was put the wrong path. The above path pages/view/files can be used when you are trying to access the controller. Not for the view. MVC gave a lot confusion. I had this problem. I just solve it.
Thanks.
I was getting this error in PyroCMS.
You can improve the error message in the Loader.php file that is in the code of the library.
Open the Loader.php file and find any calls to show_error
. I replaced mine with the following:
show_error(sprintf("Unable to load the requested file: \"%s\" with instance title of \"%s\"", $_ci_file, $_ci_data['_ci_vars']['options']['instance_title']));
I was then able to see which file was causing the issues for me.
An Error Was Encountered Unable to load the requested file:
Sometimes we face this error because the requested file doesn't exist in that directory.
Suppose we have a folder home
in views
directory and trying to load home_view.php
file as:
$this->load->view('home/home_view', $data);// $data is array
If home_view.php
file doesn't exist in views/home
directory then it will raise an error.
An Error Was Encountered Unable to load the requested file:
home\home_view.php
So how to fix this error go to views/home
and check the home_view.php
file exist if not then create it.