• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error Fatal error: Call to undefined method CI_Loader::views()

#1
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>
Reply

#2
It should be

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

not views
Reply

#3
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.
Reply

#4
(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
Reply

#5
(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
Reply

#6
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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#7
(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".
Reply

#8
Hi Dave,

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

But thanks for clarifying it for me.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#9
(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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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