CodeIgniter Forums
How to extend a selfmade 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: How to extend a selfmade controller? (/showthread.php?tid=9566)



How to extend a selfmade controller? - El Forum - 06-30-2008

[eluser]kevinh21[/eluser]
Hi everyone
I made a main controller that is used to build the website and handling errors and some things...it's called wsite Controller.

Now, i would like to "link" all my new controllers to this controller instead of CI's default Controller.

How can i do this?

wsite.php
Code:
<?php
class Wsite extends Controller
{
....
}
?>

blog.php
Code:
<?php
class Blog extends Wsite
{
....
}
?>

Where/how do i have to declare the wsite controller so that the blog controller can extend wsite?


How to extend a selfmade controller? - El Forum - 06-30-2008

[eluser]Pascal Kriete[/eluser]
Put the wsite class into the application/libraries folder and call the file MY_Controller.

Then just do what you're doing above.


How to extend a selfmade controller? - El Forum - 06-30-2008

[eluser]kevinh21[/eluser]
works Smile
Thank you