From acf21e7b025594f2f41fe19f0bb34d52b5be7629 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Tue, 9 Mar 2010 21:20:25 -0600 Subject: initial docs for Drivers --- user_guide/general/creating_drivers.html | 79 ++++++++++++++++++++++ user_guide/general/creating_libraries.html | 2 +- user_guide/general/drivers.html | 104 +++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 user_guide/general/creating_drivers.html create mode 100644 user_guide/general/drivers.html diff --git a/user_guide/general/creating_drivers.html b/user_guide/general/creating_drivers.html new file mode 100644 index 000000000..83bec8c5d --- /dev/null +++ b/user_guide/general/creating_drivers.html @@ -0,0 +1,79 @@ + + + + + +Creating Drivers : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

CodeIgniter User Guide Version 2.0.0

+
+ + + + + + + + + +
+ + +
+ + + +
+ +

Creating Drivers

+ + + + +
+ + + + + + + \ No newline at end of file diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html index 4311416e7..721e60dd0 100644 --- a/user_guide/general/creating_libraries.html +++ b/user_guide/general/creating_libraries.html @@ -289,7 +289,7 @@ Previous Topic:  Using CodeIgniter Libraries<    ·   Top of Page   ·   User Guide Home   ·   -Next Topic:  Creating Core System Classes +Next Topic:  Using CodeIgniter Drivers

CodeIgniter  ·  Copyright © 2006-2010  ·  Ellislab, Inc.

diff --git a/user_guide/general/drivers.html b/user_guide/general/drivers.html new file mode 100644 index 000000000..649b6d4db --- /dev/null +++ b/user_guide/general/drivers.html @@ -0,0 +1,104 @@ + + + + + +Using CodeIgniter Drivers : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

CodeIgniter User Guide Version 2.0.0

+
+ + + + + + + + + +
+ + +
+ + + +
+ +

Using CodeIgniter Drivers

+ + +

Drivers are a special type of Library that has a parent class and any number of potential child classes. Child classes have access to the parent class, but not their siblings. Drivers provide an elegant syntax in your controllers for libraries that benefit from or require being broken down into discrete classes.

+ +

Drivers are found in the system/libraries folder, in their own folder which is identically named to the parent library class. Also inside that folder is a subfolder named drivers, which contains all of the possible child class files.

+ +

To use a driver you will initialize it within a controller using the following initialization function:

+ +$this->load->driver('class name'); + +

Where class name is the name of the driver class you want to invoke. For example, to load a driver named "Some Parent" you would do this:

+ +$this->load->driver('some_parent'); + +

Methods of that class can then be invoked with:

+ +$this->some_parent->some_method(); + +

The child classes, the drivers themselves, can then be called directly through the parent class, without initializing them:

+ +$this->some_parent->child_one->some_method();
+$this->some_parent->child_two->another_method();
+ +

Creating Your Own Drivers

+ +

Please read the section of the user guide that discusses how to create your own drivers.

+ + + +
+ + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b