Reputation: 2992
I'm extremely new to fuel PHP and I really don't know how to fix my error:
I downloaded the .zip file of fuel php then I extracted them and put the contents in C:\wamp\www. Then I started working through This tutorial. These were the last codes I wrote:
//C:\wamp\www\fuelphp\fuel\app\classes\controller\hello2.php
<?php
class Controller_Hello2 extends Controller {
public function action_index()
{
echo "Hello World!";
}
public function action_buddy($name = 'buddy')
{
$this->response->body = View::factory('hello', array(
'name' => $name,
));
}
}
?>
//C:\wamp\www\fuelphp\fuel\app\views\hello2.php
<h1>Hello!</h1>
<p>Hey <?php echo $name ?>, how's it going?</p>
However when I run hello2.php I'm getting this:
ErrorException [ Fatal Error ]: Call to undefined method Fuel\Core\View::factory() APPPATH/classes/controller/hello2.php @ line 9
I understand the meaning, but I absolutely don't know why and how to fix this. What should I do?
Upvotes: 0
Views: 1517
Reputation: 45490
Your tutorial must be old, factory
was deprecated and now removed, use forge()
instead
$this->response->body = View::forge('hello', array(
'name' => $name,
));
Upvotes: 2