diff options
author | Pascal Kriete <pascal.kriete@ellislab.com> | 2010-11-10 22:41:28 +0100 |
---|---|---|
committer | Pascal Kriete <pascal.kriete@ellislab.com> | 2010-11-10 22:41:28 +0100 |
commit | 1f2b3f06d951d949f5b565f0955e3e68d32008e2 (patch) | |
tree | c7a543f5dc851b54b585e13100a1dde855c07885 /user_guide/general/controllers.html | |
parent | 22f1a6380b292dbe9576b4015cbfbd09618ead5d (diff) | |
parent | e79d41a0de8a21db83fdb6b3e25ae65c9923c46d (diff) |
Automated merge with http://hg.ellislab.com/CodeIgniterNoPhp4/
Diffstat (limited to 'user_guide/general/controllers.html')
-rw-r--r-- | user_guide/general/controllers.html | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index 56a1145ad..1d9cd0328 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -330,33 +330,18 @@ called if the URL contains only the sub-folder. Simply name your default contro <p>If you intend to use a constructor in any of your Controllers, you <strong>MUST</strong> place the following line of code in it:</p> -<code>parent::CI_Controller();</code> +<code>parent::__construct();</code> <p>The reason this line is necessary is because your local constructor will be overriding the one in the parent controller class so we need to manually call it.</p> - -<p>If you are not familiar with constructors, in PHP 4, a <em>constructor</em> is simply a function that has the exact same name as the class:</p> - -<code> -<?php<br /> -class <kbd>Blog</kbd> extends CI_Controller {<br /> -<br /> - function <kbd>Blog()</kbd><br /> - {<br /> - <var>parent::CI_Controller();</var><br /> - }<br /> -}<br /> -?></code> - -<p>In PHP 5, constructors use the following syntax:</p> - <code> <?php<br /> class <kbd>Blog</kbd> extends CI_Controller {<br /> <br /> function <kbd>__construct()</kbd><br /> {<br /> - <var>parent::CI_Controller();</var><br /> + <var>parent::__construct();</var><br /> + // Your own constructor code<br /> }<br /> }<br /> ?></code> |