CodeIgniter Forums
Error Fatal error: Call to undefined method CI_Loader::views() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Error Fatal error: Call to undefined method CI_Loader::views() (/showthread.php?tid=69627)



Error Fatal error: Call to undefined method CI_Loader::views() - False404 - 12-26-2017

Hello,

I'm beginners to build website from codeigniter,
I'm having problem access link : http://server.kennazjulian.com/index.php/House/halo
Message Error is : 
Fatal error: Call to undefined method CI_Loader::views() in /home/rootkenz/public_html/application/controllers/House.php on line 17
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/rootkenz/public_html/application/controllers/House.php:17)
Filename: core/Common.php
Line Number: 564
Backtrace:

A PHP Error was encountered
Severity: Error
Message: Call to undefined method CI_Loader::views()
Filename: controllers/House.php
Line Number: 17
Backtrace:


Whats wrong from my configuration? 

This is script in views/View_house.php :
Code:
[color=#000000][size=medium][font=Times New Roman]<html>
[/font][/size][/color]
<head>

        <title>WEBSITE SERVER KENNAZJULIAN>COM</title>

</head>

<body>

        <h1><?php echo $nama_web; ?></h1>

</body>
[color=#000000][size=medium][font=Times New Roman]</html>



RE: Error Fatal error: Call to undefined method CI_Loader::views() - dave friend - 12-26-2017

It should be

PHP Code:
$this->load->view('View_house'); 

not views


RE: Error Fatal error: Call to undefined method CI_Loader::views() - XtreemDeveloper - 12-28-2017

You can use this code

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Test extends CI_Controller {     
function __construct()
{

    parent::__construct();
}

function index()
{
$output['left_menu'] = 'test';
$output['left_submenu'] = 'test';
$this->load->view('default/includes/header',$output);
$this->load->view('default/test/index');
$this->load->view('default/includes/footer');
}
}

You are using incorrect format for loading file.


RE: Error Fatal error: Call to undefined method CI_Loader::views() - False404 - 12-29-2017

(12-26-2017, 08:23 AM)dave friend Wrote: It should be

PHP Code:
$this->load->view('View_house'); 

not views

Hello,

Thanks for you Response Smile
But, its Not work sir and I became dizzy  Big Grin


RE: Error Fatal error: Call to undefined method CI_Loader::views() - False404 - 12-29-2017

(12-28-2017, 12:21 AM)XtreemDeveloper Wrote: You can use this code

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Test extends CI_Controller {     
function __construct()
{

    parent::__construct();
}

function index()
{
$output['left_menu'] = 'test';
$output['left_submenu'] = 'test';
$this->load->view('default/includes/header',$output);
$this->load->view('default/test/index');
$this->load->view('default/includes/footer');
}
}

You are using incorrect format for loading file.

Hallo,

Thanks for you Response, but is there a wrong configuration of the script to me?  Idea Sad


RE: Error Fatal error: Call to undefined method CI_Loader::views() - InsiteFX - 12-30-2017

Your not loading the header or footer in your view.

Your view should be defined something like this:

Code:
<!DOCTYPE html>
<html lang="en">

<head>

       <title>WEBSITE SERVER KENNAZJULIAN>COM</title>

</head>

<body>

       <h1><?php echo $nama_web; ?></h1>

</body>
</html>

Show your code for your header and footer views.

The error is stating that you our outputting data before the view is completely loaded.


RE: Error Fatal error: Call to undefined method CI_Loader::views() - dave friend - 12-30-2017

(12-30-2017, 05:14 AM)InsiteFX Wrote: Your not loading the header or footer in your view.

Your view should be defined something like this:

Code:
<!DOCTYPE html>
<html lang="en">

<head>

       <title>WEBSITE SERVER KENNAZJULIAN>COM</title>

</head>

<body>

       <h1><?php echo $nama_web; ?></h1>

</body>
</html>

Show your code for your header and footer views.

The error is stating that you our outputting data before the view is completely loaded.

You're right about the html being malformed but wrong about what the error means. The primary error is that a call was made to a method that does not exist in CI_Loader. Line 17 of House.php probably looks like this.

PHP Code:
$this->load->views('View_house'); 

But there is no method views() in CI_Loader. The line should be.

PHP Code:
$this->load->view('View_house'); 

If the OP made that change and is still getting an error message the error is not about a "Call to undefined method CI_Loader::views() in /home/rootkenz/public_html/application/controllers/House.php on line 17".


RE: Error Fatal error: Call to undefined method CI_Loader::views() - InsiteFX - 12-30-2017

Hi Dave,

I did not mention that error because he said he fixed it from above.

But thanks for clarifying it for me.


RE: Error Fatal error: Call to undefined method CI_Loader::views() - Narf - 01-02-2018

(12-30-2017, 09:51 AM)InsiteFX Wrote: Hi Dave,

I did not mention that error because he said he fixed it from above.

But thanks for clarifying it for me.

He has not said that.