diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-05-08 15:12:34 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-05-08 15:12:34 +0200 |
commit | e50d1a82e7c24f507049ddb77afd9e1cbb29d7e8 (patch) | |
tree | f2f93d958d2a7348f6015e10a6ed0324131b2d06 | |
parent | 40306b5283b2929e344c7e11da7b736b9e51ef43 (diff) |
added code sample showing the necessity of referencing the extended class in your application controllers instead of the core Controller class when extending the Controller
-rw-r--r-- | user_guide/general/core_classes.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/user_guide/general/core_classes.html b/user_guide/general/core_classes.html index 65e9a2b2b..ff9896c3e 100644 --- a/user_guide/general/core_classes.html +++ b/user_guide/general/core_classes.html @@ -140,6 +140,20 @@ class MY_Input extends CI_Input {<br /> (this is known as "method overriding").
This allows you to substantially alter the CodeIgniter core.</p>
+<p>If you are extending the Controller core class, then be sure to extend your new class in your application controller's constructors.</p>
+
+<code>class Welcome extends MY_Controller {<br />
+<br />
+ function Welcome()<br />
+ {<br />
+ parent::MY_Controller();<br />
+ }<br />
+<br />
+ function index()<br />
+ {<br />
+ $this->load->view('welcome_message');<br />
+ }<br />
+}</code>
<h3>Setting Your Own Prefix</h3>
|