Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load the requested file error in codeigniter

I am new to CodeIgniter. I am getting this problem.

Unable to load the requested file:
http://localhost/grf_new/index.php/reservation/details/34/.php

the code looks like this

$this->load->view(base_url().index_page().'/reservation/details/'.$userid.'/', $data);
like image 494
user2621440 Avatar asked Nov 18 '25 18:11

user2621440


1 Answers

Codeigniter Documentation: http://ellislab.com/codeigniter/user-guide/general/views.html

Loading a View

To load a particular view file you will use the following function:

$this->load->view('viewfile', $yourdata);

Where viewfile is the name of your view file. Note: The .php file extension does not need to be specified unless you use something other than .php.

Now, open the controller file you made earlier called blog.php, and replace the echo statement with the view loading function:

<?php
class Reservation extends CI_Controller {

    function details($id)
    {
        $this->data['user_info'] = $this->user_model->getUser($id)->result();
        $this->load->view('userdetails', $this->data);
    }
}
?>

If you visit your site using the URL you did earlier you should see your new view. The URL was similar to this:

example.com/reservation/details/34
like image 107
Bora Avatar answered Nov 21 '25 07:11

Bora



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!