summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/general/drivers.rst
diff options
context:
space:
mode:
authorMike Funk <mfunk@xulonpress.com>2011-10-10 16:31:56 +0200
committerMike Funk <mfunk@xulonpress.com>2011-10-10 16:31:56 +0200
commit8afb848fded8fbdfa24b72df7f067e960c83c0e8 (patch)
treebf3d8fa70610253cb13a87c1aa9d634dcee9f413 /user_guide_src/source/general/drivers.rst
parent25246b6b29d87ad7a4f304a7b5623c9f57953356 (diff)
parentbdbe6d222c15e9d1b42a8ee3a3e7fe04b753c1ba (diff)
Codeigniter develop latest.
Diffstat (limited to 'user_guide_src/source/general/drivers.rst')
-rw-r--r--user_guide_src/source/general/drivers.rst40
1 files changed, 40 insertions, 0 deletions
diff --git a/user_guide_src/source/general/drivers.rst b/user_guide_src/source/general/drivers.rst
new file mode 100644
index 000000000..e2ded62e2
--- /dev/null
+++ b/user_guide_src/source/general/drivers.rst
@@ -0,0 +1,40 @@
+#########################
+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 :doc:`controllers <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 :doc:`create
+your own drivers <creating_drivers>`.