Welcome Guest, Not a member yet? Register   Sign In
Error - Unable to load the requested file.
#1

[eluser]Unknown[/eluser]
I am creating a login component. I am learning from a video tutorial. I had created a template ( header, dynamic( body), footer). I get an error ” Unable to load the requested file. loginform.php”.
Using an array i pass the name of the dynamic ( body) page, but then this value is not being set in $this->load->view(‘includes/template’,$data).


#—View—#
template.php———- path——views/includes/template.php

<?php $this->load->view(‘includes/header’); ?>
<?php $this->load->view($maincontent); ?>
<?php $this->load->view(‘includes/footer’); ?>
————————————————————————————————-
#—Controller—#

login.php

<?php
class Login extends CI_Controller{
public function index()
{
$data[‘maincontent’] = ‘loginform’;
$this->load->view(‘includes/template’,$data); //this is not working.
}
}
?>


Can you help me resolve it ?


Aarthi
#2

[eluser]Unknown[/eluser]
Hi,
I have resolved the error. Wrong path error.
The template.php file should have been like this.

<?php $this->load->view(‘includes/header’); ?>
<?php $this->load->view('includes/'. $maincontent); ?>
<?php $this->load->view(‘includes/footer’); ?>

This will resolve the problem.


Aarthi
#3

[eluser]regal2157[/eluser]
Sorry I didn't get back to you in time. Yes, I know I ran into that error as well. I believe the tutorial for that keeps the $maincontent views outside the includes folder. No reason to put all your views inside the include folder. That would be pointless.




Theme © iAndrew 2016 - Forum software by © MyBB