summaryrefslogtreecommitdiffstats
path: root/user_guide
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide')
-rw-r--r--user_guide/general/controllers.html19
-rw-r--r--user_guide/helpers/smiley_helper.html4
-rw-r--r--user_guide/libraries/file_uploading.html4
3 files changed, 6 insertions, 21 deletions
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html
index 56a1145ad..bcd0e4bce 100644
--- a/user_guide/general/controllers.html
+++ b/user_guide/general/controllers.html
@@ -330,26 +330,10 @@ 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>
-&lt;?php<br />
-class <kbd>Blog</kbd> extends CI_Controller {<br />
-<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function <kbd>Blog()</kbd><br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<var>parent::CI_Controller();</var><br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
-}<br />
-?&gt;</code>
-
-<p>In PHP 5, constructors use the following syntax:</p>
-
<code>
&lt;?php<br />
class <kbd>Blog</kbd> extends CI_Controller {<br />
@@ -357,6 +341,7 @@ class <kbd>Blog</kbd> extends CI_Controller {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function <kbd>__construct()</kbd><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<var>parent::CI_Controller();</var><br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Your own constructor code<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
?&gt;</code>
diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html
index d7c2d16e7..6846b78e7 100644
--- a/user_guide/helpers/smiley_helper.html
+++ b/user_guide/helpers/smiley_helper.html
@@ -101,9 +101,9 @@ your <dfn>smiley</dfn> folder.</p>
class Smileys extends CI_Controller {
- function Smileys()
+ function __construct()
{
- parent::CI_Controller();
+ parent::__construct();
}
function index()
diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html
index ea0e2a283..00bc0c076 100644
--- a/user_guide/libraries/file_uploading.html
+++ b/user_guide/libraries/file_uploading.html
@@ -146,9 +146,9 @@ folder:</p>
class Upload extends CI_Controller {
- function Upload()
+ function __construct()
{
- parent::CI_Controller();
+ parent::__construct();
$this->load->helper(array('form', 'url'));
}