From e79d41a0de8a21db83fdb6b3e25ae65c9923c46d Mon Sep 17 00:00:00 2001 From: Pascal Kriete Date: Wed, 10 Nov 2010 16:41:23 -0500 Subject: Userguide tweaks to show proper PHP 5 examples and removing the compat helper from the menu. --- user_guide/general/controllers.html | 2 +- user_guide/general/core_classes.html | 8 ++++---- user_guide/general/creating_libraries.html | 6 +++--- user_guide/general/models.html | 12 ++++++------ user_guide/general/styleguide.html | 5 ++--- 5 files changed, 16 insertions(+), 17 deletions(-) (limited to 'user_guide/general') diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index bcd0e4bce..1d9cd0328 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -340,7 +340,7 @@ class Blog extends CI_Controller {

       function __construct()
       {
-            parent::CI_Controller();
+            parent::__construct();
            // Your own constructor code
       }
}
diff --git a/user_guide/general/core_classes.html b/user_guide/general/core_classes.html index ac965aee3..35043d9ca 100644 --- a/user_guide/general/core_classes.html +++ b/user_guide/general/core_classes.html @@ -131,9 +131,9 @@ class MY_Input extends CI_Input {

class MY_Input extends CI_Input {

-    function MY_Input()
+    function __construct()
    {
-        parent::CI_Input();
+        parent::__construct();
    }
}
@@ -145,9 +145,9 @@ This allows you to substantially alter the CodeIgniter core.

class Welcome extends MY_Controller {

-    function Welcome()
+    function __construct()
    {
-        parent::MY_Controller();
+        parent::__construct();
    }

    function index()
diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html index 3f0e32cb0..00d0f4aa4 100644 --- a/user_guide/general/creating_libraries.html +++ b/user_guide/general/creating_libraries.html @@ -141,7 +141,7 @@ $this->load->library('Someclass', $params);

class Someclass {

-    function Someclass($params)
+    function __construct($params)
    {
        // Do something with $params
    }
@@ -248,9 +248,9 @@ class MY_Email extends CI_Email {

class MY_Email extends CI_Email {

-    function My_Email()
+    function __construct()
    {
-        parent::CI_Email();
+        parent::__construct();
    }
}
diff --git a/user_guide/general/models.html b/user_guide/general/models.html index 35ab08d20..466996648 100644 --- a/user_guide/general/models.html +++ b/user_guide/general/models.html @@ -83,10 +83,10 @@ class Blogmodel extends CI_Model {
    var $content = '';
    var $date    = '';

-    function Blogmodel()
+    function __construct()
    {
        // Call the Model constructor
-        parent::CI_Model();
+        parent::__construct();
    }
    
    function get_last_ten_entries()
@@ -128,9 +128,9 @@ want this type of organization.

class Model_name extends CI_Model {

-    function Model_name()
+    function __construct()
    {
-        parent::CI_Model();
+        parent::__construct();
    }
}
@@ -142,9 +142,9 @@ Make sure your class extends the base Model class.

class User_model extends CI_Model {

-    function User_model()
+    function __construct()
    {
-        parent::CI_Model();
+        parent::__construct();
    }
}
diff --git a/user_guide/general/styleguide.html b/user_guide/general/styleguide.html index 7b7d837d9..f30f45529 100644 --- a/user_guide/general/styleguide.html +++ b/user_guide/general/styleguide.html @@ -161,7 +161,7 @@ echo "Here's my code!";

Class and Method Naming

-

Class names should always have their first letter uppercase, and the constructor method should match identically. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.

+

Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.

INCORRECT: class superclass @@ -170,11 +170,10 @@ class SuperClass CORRECT: class Super_class -

Notice that the Class and constructor methods are identically named and cased:

class Super_class { - function Super_class() + function __construct() { } -- cgit v1.2.3-24-g4f1b