• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error - Unable to load the requested file.

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).

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

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


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 ?


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.


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.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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