CodeIgniter Forums
Parent::controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Parent::controller (/showthread.php?tid=43900)



Parent::controller - El Forum - 07-27-2011

[eluser]suzie[/eluser]
Dear Sir,

Am watching the video tutorial from the site, but when am adding the function BLog:

<?php
class Blog extends CI_Controller {


Quote: function Blog()

{
parent::Controller();
}
function index()
{
}

}

?>

it gives me an error:

Fatal error: Call to undefined method CI_Controller::controller() in C:\wamp\www\application\controllers\blog.php on line 8




Any help please??


Parent::controller - El Forum - 07-27-2011

[eluser]cpass78[/eluser]
What version of php are you running


Parent::controller - El Forum - 07-27-2011

[eluser]InsiteFX[/eluser]
If your running CodeIgniter v2.0.+ then you have to change Controller to CI_Controller and Model to CI_Model
also the constructor is new!
Code:
public function __construct()
{
    // NOTE: The constructor is not need unless you are setting parameters!
    parent::__construct();
}

InsiteFX


Parent::controller - El Forum - 07-28-2011

[eluser]suzie[/eluser]
yeah am using Codeigniter V2.0, thanks a lot it works now...
I need it because I want to load Helper to use the function anchor(); for comments