From b42466419f4b49cf5121f3103f7dd342075458db Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Thu, 10 Mar 2011 20:32:56 -0500 Subject: Fixed missing parentheses and added scope to examples. Fixes #103 --- user_guide/general/controllers.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index ccc5302f8..2da98b6c7 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -98,7 +98,7 @@ Controllers <?php class Blog extends CI_Controller { - function index() + public function index() { echo 'Hello World!'; } @@ -153,12 +153,12 @@ class blog extends CI_Controller {
<?php class Blog extends CI_Controller { - function index() + public function index() { echo 'Hello World!'; } - function comments() + public function comments() { echo 'Look at this!'; } @@ -187,7 +187,7 @@ class Blog extends CI_Controller { <?php
class Products extends CI_Controller {

-    function shoes($sandals, $id)
+    public function shoes($sandals, $id)
    {
        echo $sandals;
        echo $id;
@@ -220,7 +220,7 @@ specifying any URI segments you'll see your Hello World message by default.

As noted above, the second segment of the URI typically determines which function in the controller gets called. CodeIgniter permits you to override this behavior through the use of the _remap() function:

-function _remap()
+public function _remap()
{
    // Some code here...
}
@@ -231,7 +231,7 @@ allowing you to define your own function routing rules.

The overridden function call (typically the second segment of the URI) will be passed as a parameter to the _remap() function:

-function _remap($method)
+public function _remap($method)
{
    if ($method == 'some_method')
    {
@@ -245,10 +245,10 @@ allowing you to define your own function routing rules.

Any extra segments after the method name are passed into _remap() as an optional second parameter. This array can be used in combination with PHP's call_user_func_array to emulate CodeIgniter's default behavior.

-function _remap($method, $params = array())
+public function _remap($method, $params = array())
{
    $method = 'process_'.$method;
-    if (method_exists($this, $method)
+    if (method_exists($this, $method))
    {
        return call_user_func_array(array($this, $method), $params);
    }
@@ -270,7 +270,7 @@ be called by the output class instead of echoing the finalized data directly. Th

Here is an example:

-function _output($output)
+public function _output($output)
{
    echo $output;
}
@@ -298,7 +298,7 @@ the available methods in the Output Class underscore as the name prefix and it will not be served via a URL request. For example, if you were to have a function like this:

-function _utility()
+private function _utility()
{
  // some code
}
@@ -346,7 +346,7 @@ called if the URL contains only the sub-folder. Simply name your default contro <?php
class Blog extends CI_Controller {

-       function __construct()
+       public function __construct()
       {
            parent::__construct();
            // Your own constructor code
-- cgit v1.2.3-24-g4f1b