bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
3 |
<head> |
|
4 |
||
5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
6 |
<title>Using CodeIgniter Drivers : CodeIgniter User Guide</title> |
|
7 |
||
8 |
<style type='text/css' media='all'>@import url('../userguide.css');</style> |
|
9 |
<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' /> |
|
10 |
||
11 |
<script type="text/javascript" src="../nav/nav.js"></script> |
|
12 |
<script type="text/javascript" src="../nav/prototype.lite.js"></script> |
|
13 |
<script type="text/javascript" src="../nav/moo.fx.js"></script> |
|
14 |
<script type="text/javascript" src="../nav/user_guide_menu.js"></script> |
|
15 |
||
16 |
<meta http-equiv='expires' content='-1' /> |
|
17 |
<meta http-equiv= 'pragma' content='no-cache' /> |
|
18 |
<meta name='robots' content='all' /> |
|
19 |
<meta name='author' content='ExpressionEngine Dev Team' /> |
|
20 |
<meta name='description' content='CodeIgniter User Guide' /> |
|
21 |
||
22 |
</head> |
|
23 |
<body> |
|
24 |
||
25 |
<!-- START NAVIGATION -->
|
|
26 |
<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div> |
|
27 |
<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div> |
|
28 |
<div id="masthead"> |
|
29 |
<table cellpadding="0" cellspacing="0" border="0" style="width:100%"> |
|
30 |
<tr> |
|
31 |
<td><h1>CodeIgniter User Guide Version 2.1.3</h1></td> |
|
32 |
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td> |
|
33 |
</tr> |
|
34 |
</table> |
|
35 |
</div> |
|
36 |
<!-- END NAVIGATION -->
|
|
37 |
||
38 |
||
39 |
<!-- START BREADCRUMB -->
|
|
40 |
<table cellpadding="0" cellspacing="0" border="0" style="width:100%"> |
|
41 |
<tr> |
|
42 |
<td id="breadcrumb"> |
|
43 |
<a href="http://codeigniter.com/">CodeIgniter Home</a> › |
|
44 |
<a href="../index.html">User Guide Home</a> › |
|
45 |
Using CodeIgniter Drivers |
|
46 |
</td> |
|
47 |
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" /> <input type="submit" class="submit" name="sa" value="Go" /></form></td> |
|
48 |
</tr> |
|
49 |
</table> |
|
50 |
<!-- END BREADCRUMB -->
|
|
51 |
||
52 |
<br clear="all" /> |
|
53 |
||
54 |
||
55 |
<!-- START CONTENT -->
|
|
56 |
<div id="content"> |
|
57 |
||
58 |
<h1>Using CodeIgniter Drivers</h1> |
|
59 |
||
60 |
||
61 |
<p>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 <a href="controllers.html">controllers</a> for libraries that benefit from or require being broken down into discrete classes.</p> |
|
62 |
||
63 |
<p>Drivers are found in the <dfn>system/libraries</dfn> folder, in their own folder which is identically named to the parent library class. Also inside that folder is a subfolder named <kbd>drivers</kbd>, which contains all of the possible child class files.</p> |
|
64 |
||
65 |
<p>To use a driver you will initialize it within a controller using the following initialization function:</p> |
|
66 |
||
67 |
<code>$this->load->driver('<var>class name</var>'); </code> |
|
68 |
||
69 |
<p>Where <var>class name</var> is the name of the driver class you want to invoke. For example, to load a driver named "Some Parent" you would do this:</p> |
|
70 |
||
71 |
<code>$this->load->driver('<var>some_parent</var>');</code> |
|
72 |
||
73 |
<p>Methods of that class can then be invoked with:</p> |
|
74 |
||
75 |
<code>$this->some_parent->some_method();</code> |
|
76 |
||
77 |
<p>The child classes, the drivers themselves, can then be called directly through the parent class, without initializing them:</p> |
|
78 |
||
79 |
<code>$this->some_parent->child_one->some_method();<br /> |
|
80 |
$this->some_parent->child_two->another_method();</code> |
|
81 |
||
82 |
<h2>Creating Your Own Drivers</h2> |
|
83 |
||
84 |
<p>Please read the section of the user guide that discusses how to <a href="creating_drivers.html">create your own drivers</a>.</p> |
|
85 |
||
86 |
||
87 |
||
88 |
</div> |
|
89 |
<!-- END CONTENT -->
|
|
90 |
||
91 |
||
92 |
<div id="footer"> |
|
93 |
<p> |
|
94 |
Previous Topic: <a href="creating_libraries.html">Creating Libraries</a> |
|
95 |
·
|
|
96 |
<a href="#top">Top of Page</a> · |
|
97 |
<a href="../index.html">User Guide Home</a> · |
|
98 |
Next Topic: <a href="creating_drivers.html">Creating Drivers</a> |
|
99 |
</p> |
|
100 |
<p><a href="http://codeigniter.com">CodeIgniter</a> · Copyright © 2006 - 2012 · <a href="http://ellislab.com/">EllisLab, Inc.</a></p> |
|
101 |
</div> |
|
102 |
||
103 |
</body> |
|
104 |
</html> |