summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-05-08 15:12:34 +0200
committerDerek Jones <derek.jones@ellislab.com>2008-05-08 15:12:34 +0200
commite50d1a82e7c24f507049ddb77afd9e1cbb29d7e8 (patch)
treef2f93d958d2a7348f6015e10a6ed0324131b2d06
parent40306b5283b2929e344c7e11da7b736b9e51ef43 (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.html14
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 />
+&nbsp;&nbsp;&nbsp;&nbsp;function Welcome()<br />
+&nbsp;&nbsp;&nbsp;&nbsp;{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parent::MY_Controller();<br />
+&nbsp;&nbsp;&nbsp;&nbsp;}<br />
+<br />
+&nbsp;&nbsp;&nbsp;&nbsp;function index()<br />
+&nbsp;&nbsp;&nbsp;&nbsp;{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this->load->view('welcome_message');<br />
+&nbsp;&nbsp;&nbsp;&nbsp;}<br />
+}</code>
<h3>Setting Your Own Prefix</h3>