From e334c472fb4be44feec3a73402fc4a2b062cbfc0 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 21 Oct 2006 19:44:22 +0000 Subject: --- user_guide/general/creating_libraries.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'user_guide/general/creating_libraries.html') diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html index d76464120..12f8f9fc9 100644 --- a/user_guide/general/creating_libraries.html +++ b/user_guide/general/creating_libraries.html @@ -12,7 +12,7 @@ @@ -63,11 +63,11 @@ Creating Libraries

Creating Libraries

When we use the term "Libraries" we are normally referring to the classes that are located in the libraries -directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create -your own libraries within your application/libraries directory in order to maintain separation between your local resources +directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create +your own libraries within your application/libraries directory in order to maintain separation between your local resources and the global framework resources.

-

As an added bonus, Code Igniter permits your libraries to extend native classes if you simply need to add some functionality +

As an added bonus, Code Igniter permits your libraries to extend native classes if you simply need to add some functionality to an existing library. Or you can even replace native libraries just by placing identically named versions in your application/libraries folder.

In summary:

@@ -86,7 +86,7 @@ nor can the main Controller class. All other classes are able to be replaced/ex

Storage

-

Your library classes should be placed within your application/libraries folder, as this is where Code Igniter will look for them when +

Your library classes should be placed within your application/libraries folder, as this is where Code Igniter will look for them when they are initialized.

@@ -120,7 +120,7 @@ class Someclass {
$this->load->library('someclass'); -

Where someclass is the file name, without the ".php" file extension. You can submit the file name capitalized or lower case. +

Where someclass is the file name, without the ".php" file extension. You can submit the file name capitalized or lower case. Code Igniter doesn't care.

Once loaded you can access your class using the lower case version:

@@ -132,7 +132,7 @@ Code Igniter doesn't care.

Passing Parameters When Initializing Your Class

-

In the library loading function you can dynamically pass data via the second parameter and it will be passed to your class +

In the library loading function you can dynamically pass data via the second parameter and it will be passed to your class constructor:

@@ -178,7 +178,7 @@ This function returns the Code Igniter super object.

etc.
-

$this, however, only works directly within your controllers, your models, or your views. +

$this, however, only works directly within your controllers, your models, or your views. If you would like to use Code Igniter's classes from within your own custom classes you can do so as follows:

@@ -231,7 +231,7 @@ Extending a class is nearly identical to replacing a class with a couple excepti

For example, to extend the native Email class you'll create a file named application/libraries/MY_Email.php, and declare your class with:

@@ -261,7 +261,7 @@ to load the example above, which extends the Email class, you will use:

$this->load->library('email'); -

Once loaded you will use the class variable as you normally would for the class you are extending. In the case of +

Once loaded you will use the class variable as you normally would for the class you are extending. In the case of the email class all calls will use: -- cgit v1.2.3-24-g4f1b