loader.html 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Loader Class &mdash; CodeIgniter 3.1.11 documentation</title>
  8. <link rel="shortcut icon" href="../_static/ci-icon.ico"/>
  9. <link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
  10. <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" />
  11. <link rel="index" title="Index"
  12. href="../genindex.html"/>
  13. <link rel="search" title="Search" href="../search.html"/>
  14. <link rel="top" title="CodeIgniter 3.1.11 documentation" href="../index.html"/>
  15. <link rel="up" title="Libraries" href="index.html"/>
  16. <link rel="next" title="Migrations Class" href="migration.html"/>
  17. <link rel="prev" title="Language Class" href="language.html"/>
  18. <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
  19. </head>
  20. <body class="wy-body-for-nav" role="document">
  21. <div id="nav">
  22. <div id="nav_inner">
  23. <div id="pulldown-menu" class="ciNav">
  24. <ul>
  25. <li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
  26. </ul>
  27. <ul>
  28. <li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
  29. <li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
  30. <li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
  31. <li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
  32. <li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
  33. </ul>
  34. </li>
  35. </ul>
  36. <ul>
  37. <li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
  38. <li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
  39. <li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
  40. <li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
  41. <li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
  42. <li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
  43. <li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
  44. </ul>
  45. </li>
  46. </ul>
  47. <ul>
  48. <li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
  49. <li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
  50. <li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
  51. <li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
  52. <li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
  53. </ul>
  54. </li>
  55. </ul>
  56. <ul>
  57. <li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
  58. <li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
  59. <li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
  60. </ul>
  61. </li>
  62. </ul>
  63. <ul>
  64. <li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
  65. <li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
  66. <li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
  67. <li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
  68. <li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
  69. <li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
  70. <li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
  71. <li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
  72. <li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
  73. <li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
  74. <li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
  75. <li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
  76. <li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
  77. <li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
  78. <li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
  79. <li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
  80. <li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
  81. <li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
  82. <li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
  83. <li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
  84. <li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
  85. <li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
  86. <li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
  87. <li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
  88. <li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
  89. <li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
  90. <li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
  91. </ul>
  92. </li>
  93. </ul>
  94. <ul class="current">
  95. <li class="toctree-l1 current"><a class="reference internal" href="index.html">Libraries</a><ul class="current">
  96. <li class="toctree-l2"><a class="reference internal" href="benchmark.html">Benchmarking Class</a></li>
  97. <li class="toctree-l2"><a class="reference internal" href="caching.html">Caching Driver</a></li>
  98. <li class="toctree-l2"><a class="reference internal" href="calendar.html">Calendaring Class</a></li>
  99. <li class="toctree-l2"><a class="reference internal" href="cart.html">Shopping Cart Class</a></li>
  100. <li class="toctree-l2"><a class="reference internal" href="config.html">Config Class</a></li>
  101. <li class="toctree-l2"><a class="reference internal" href="email.html">Email Class</a></li>
  102. <li class="toctree-l2"><a class="reference internal" href="encrypt.html">Encrypt Class</a></li>
  103. <li class="toctree-l2"><a class="reference internal" href="encryption.html">Encryption Library</a></li>
  104. <li class="toctree-l2"><a class="reference internal" href="file_uploading.html">File Uploading Class</a></li>
  105. <li class="toctree-l2"><a class="reference internal" href="form_validation.html">Form Validation</a></li>
  106. <li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP Class</a></li>
  107. <li class="toctree-l2"><a class="reference internal" href="image_lib.html">Image Manipulation Class</a></li>
  108. <li class="toctree-l2"><a class="reference internal" href="input.html">Input Class</a></li>
  109. <li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript Class</a></li>
  110. <li class="toctree-l2"><a class="reference internal" href="language.html">Language Class</a></li>
  111. <li class="toctree-l2 current"><a class="current reference internal" href="#">Loader Class</a></li>
  112. <li class="toctree-l2"><a class="reference internal" href="migration.html">Migrations Class</a></li>
  113. <li class="toctree-l2"><a class="reference internal" href="output.html">Output Class</a></li>
  114. <li class="toctree-l2"><a class="reference internal" href="pagination.html">Pagination Class</a></li>
  115. <li class="toctree-l2"><a class="reference internal" href="parser.html">Template Parser Class</a></li>
  116. <li class="toctree-l2"><a class="reference internal" href="security.html">Security Class</a></li>
  117. <li class="toctree-l2"><a class="reference internal" href="sessions.html">Session Library</a></li>
  118. <li class="toctree-l2"><a class="reference internal" href="table.html">HTML Table Class</a></li>
  119. <li class="toctree-l2"><a class="reference internal" href="trackback.html">Trackback Class</a></li>
  120. <li class="toctree-l2"><a class="reference internal" href="typography.html">Typography Class</a></li>
  121. <li class="toctree-l2"><a class="reference internal" href="unit_testing.html">Unit Testing Class</a></li>
  122. <li class="toctree-l2"><a class="reference internal" href="uri.html">URI Class</a></li>
  123. <li class="toctree-l2"><a class="reference internal" href="user_agent.html">User Agent Class</a></li>
  124. <li class="toctree-l2"><a class="reference internal" href="xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
  125. <li class="toctree-l2"><a class="reference internal" href="zip.html">Zip Encoding Class</a></li>
  126. </ul>
  127. </li>
  128. </ul>
  129. <ul>
  130. <li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
  131. <li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
  132. <li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
  133. <li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
  134. <li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
  135. <li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
  136. <li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
  137. <li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
  138. <li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
  139. <li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
  140. <li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
  141. <li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
  142. <li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
  143. <li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
  144. <li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
  145. </ul>
  146. </li>
  147. </ul>
  148. <ul>
  149. <li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
  150. <li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
  151. <li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
  152. <li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
  153. <li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
  154. <li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
  155. <li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
  156. <li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
  157. <li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
  158. <li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
  159. <li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
  160. <li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
  161. <li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
  162. <li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
  163. <li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
  164. <li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
  165. <li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
  166. <li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
  167. <li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
  168. <li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
  169. <li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
  170. <li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
  171. </ul>
  172. </li>
  173. </ul>
  174. </div>
  175. </div>
  176. </div>
  177. <div id="nav2">
  178. <a href="#" id="openToc">
  179. <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKwCaAwERAAIRAQMRAf/EAHsAAQAABwEBAAAAAAAAAAAAAAABAwQFBgcIAgkBAQAAAAAAAAAAAAAAAAAAAAAQAAEDAwICBwYEAgsAAAAAAAIBAwQAEQUSBiEHkROTVNQWGDFBUVIUCHEiMtOUFWGBobHRQlMkZIRVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDSC+ygkOOaUoKigUCgUCgUCgUCgUCgUCgUCgkuGguIP9FBMFb0Hqg7We+3jlmIqqYFf4ub+/QYlnOR/LqIBKGFUbf8qWv971BytQXXE7Y3Lnm3HsFhp2TaZJAdchRXpIgSpdEJWxJEW3xoKV7F5OMy7JkQn2o7D6w33XGjEAkoiqrJEqIiOIiKuhePCgqp22dyYyS3CyWHnQ5joG61HkRnmnTbaFSMhExRVQRRVJU9iUHjE7ez+fJ0MFipmUNhBV8YUd2SoIV9KkjQla9ltegttBdPLW4/qocL+UTfrMiHW4+P9M71shuyrqaHTcxsl7jegpsji8nh5ZwMvDfgTm0RTjSmjYdFCS6KoOIipdFunCgmNYTMv457MMY6U7iI6oMieDDhRm1VbIhuoOkbqtuK0Hpzb+eZcYZexUxt6UyUqK2cd0SdjtgrhOgijcgERUlJOCIl6CpgbP3blRI8XgMjNARAyKNDfeRBdFDBVUAXgQrqH4pxoJTu2NysY97LP4ac1io5q1InHFeGO24LnVKJuKOkSQ/yKir+rh7aCLG1dzypZQI2FnvTgccYOM3FeN0XWERXAUEFVQgQkUktdLpegm+Td3/Xli/L+S/mYNJIOF9G/wBeLKrZHFb0akG6W1WtQWSg3Dyg5e7V3fipE3O4/wCrktyzYA+ufas2LbZIlmnAT2kvuoN1wft95augilglX/tzP3qCu9O3LL/wV/i5v79BvmTADq14UGu91467Z6U9y0HzH/ncj/U/sT/CgynZG7I2NezpZGUjIycJkYkZSG+uQ81pbBNKLxJfjwoMqZ3/ALYHl35AJ7/cuwHcu5k7r1Q5pHetBjquqVVJWGxj9Zrtcl/Ggy3dHMvauR3HFZj5nHNxSyW5JISYDMoIwx8tFIGHZhPNaykGapr6rUAiicEoMG21lMRj8buPAz8xhJrr7uOeiPTCyAwXUaGR1mgozbTusOsFLEiJ7fbQa/h7gcjy2H3V6xppwDNtUSxCJIqp7valBuWVzJ22xuCROXNNZiJkMtms0DbjUkAZjzoDrTMd9dDRI44ZC2YsrYdKWP2WDT2S3N9dNdlRYrGMYc06IURXSYb0igrpWS485xVNS6nF4rwslkoMwnbpgZLB7bmt5uMweAhDEl4B5uSLzzqTnnyVpW2jaJHRMSIjdDiiotvy3DOE5rYTEbkl5yFn28k7JyG4c7AU2HtLH1uKfaiMPI40CdYbpNtmLdwTSn5rewLNld+7TLdeal4WarWBkbVKBjgdElMJJwAAY5fl4kB3b1fp4XvagsGS3FjJfLzDNtS8aeXx7LzT7TyzByQE5PccRGRC0ZRUDRV6y62vbjagzLmJzS2vuPK43JY6aP1TW6Jz+RIWyFtyC06y3EkiiinAo7YCqfq1AqqnGgsOH3lhZO8d1pmcpB8j5XIm9OYlBJSQ/FSS4427DKO0RC8AlcEMhFdViRR1WDWR5t3WXVuL1d106kG9vdeye2g60+1FDyW0shIcXVpyroXt8I8dfd+NB1vioAdWnD3UF1+gD4UFc6CEKpagxXN43rwJLUHz7yX2c8zokt9uHlsPIhA4aRnnHJTLptIS6CNsY7iASpxUUMkReGpfbQW0vtN5pitvrsN28rwtBD0nc0+/Yft5XhaB6TuaXfsP28rwtA9J3NPv2H7eV4Wgek7mn37D9vK8LQPSdzT79h+3leFoHpO5pd+w/byvC0D0nc0u/Yft5XhaB6TuaXfsP28rwtA9J3NLv2H7eV4Wgek7ml37D9vK8LQPSdzS79h+3leFoHpO5p9+w/byvC0E9r7Reazy2HIYVPxkS/CUHVn26cosxyv2g7h89LYmZSXOenvLEQ1YaQ222RATcQCP8rSGqqA8S02W2pQ6FhMoAIlqCtsnwoCpdKClejI4i3Sgtb+GBxVuNBSFt1pV/RQefLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8utJ/koJ7WCbBU/LQXOPAFq1koK8B0pag90CggtBBf6qB0UDooHRQOigdFA6KB0UDooHRQOigdFA6KB0UDooI0EaBQf//Z" title="Toggle Table of Contents" alt="Toggle Table of Contents" />
  180. </a>
  181. </div>
  182. <div class="wy-grid-for-nav">
  183. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  184. <div class="wy-side-nav-search">
  185. <a href="../index.html" class="fa fa-home"> CodeIgniter</a>
  186. <div role="search">
  187. <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
  188. <input type="text" name="q" placeholder="Search docs" />
  189. <input type="hidden" name="check_keywords" value="yes" />
  190. <input type="hidden" name="area" value="default" />
  191. </form>
  192. </div>
  193. </div>
  194. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  195. <ul>
  196. <li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
  197. </ul>
  198. <ul>
  199. <li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
  200. <li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
  201. <li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
  202. <li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
  203. <li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
  204. </ul>
  205. </li>
  206. </ul>
  207. <ul>
  208. <li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
  209. <li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
  210. <li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
  211. <li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
  212. <li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
  213. <li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
  214. <li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
  215. </ul>
  216. </li>
  217. </ul>
  218. <ul>
  219. <li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
  220. <li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
  221. <li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
  222. <li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
  223. <li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
  224. </ul>
  225. </li>
  226. </ul>
  227. <ul>
  228. <li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
  229. <li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
  230. <li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
  231. </ul>
  232. </li>
  233. </ul>
  234. <ul>
  235. <li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
  236. <li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
  237. <li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
  238. <li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
  239. <li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
  240. <li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
  241. <li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
  242. <li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
  243. <li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
  244. <li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
  245. <li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
  246. <li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
  247. <li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
  248. <li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
  249. <li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
  250. <li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
  251. <li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
  252. <li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
  253. <li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
  254. <li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
  255. <li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
  256. <li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
  257. <li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
  258. <li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
  259. <li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
  260. <li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
  261. <li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
  262. </ul>
  263. </li>
  264. </ul>
  265. <ul class="current">
  266. <li class="toctree-l1 current"><a class="reference internal" href="index.html">Libraries</a><ul class="current">
  267. <li class="toctree-l2"><a class="reference internal" href="benchmark.html">Benchmarking Class</a></li>
  268. <li class="toctree-l2"><a class="reference internal" href="caching.html">Caching Driver</a></li>
  269. <li class="toctree-l2"><a class="reference internal" href="calendar.html">Calendaring Class</a></li>
  270. <li class="toctree-l2"><a class="reference internal" href="cart.html">Shopping Cart Class</a></li>
  271. <li class="toctree-l2"><a class="reference internal" href="config.html">Config Class</a></li>
  272. <li class="toctree-l2"><a class="reference internal" href="email.html">Email Class</a></li>
  273. <li class="toctree-l2"><a class="reference internal" href="encrypt.html">Encrypt Class</a></li>
  274. <li class="toctree-l2"><a class="reference internal" href="encryption.html">Encryption Library</a></li>
  275. <li class="toctree-l2"><a class="reference internal" href="file_uploading.html">File Uploading Class</a></li>
  276. <li class="toctree-l2"><a class="reference internal" href="form_validation.html">Form Validation</a></li>
  277. <li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP Class</a></li>
  278. <li class="toctree-l2"><a class="reference internal" href="image_lib.html">Image Manipulation Class</a></li>
  279. <li class="toctree-l2"><a class="reference internal" href="input.html">Input Class</a></li>
  280. <li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript Class</a></li>
  281. <li class="toctree-l2"><a class="reference internal" href="language.html">Language Class</a></li>
  282. <li class="toctree-l2 current"><a class="current reference internal" href="#">Loader Class</a></li>
  283. <li class="toctree-l2"><a class="reference internal" href="migration.html">Migrations Class</a></li>
  284. <li class="toctree-l2"><a class="reference internal" href="output.html">Output Class</a></li>
  285. <li class="toctree-l2"><a class="reference internal" href="pagination.html">Pagination Class</a></li>
  286. <li class="toctree-l2"><a class="reference internal" href="parser.html">Template Parser Class</a></li>
  287. <li class="toctree-l2"><a class="reference internal" href="security.html">Security Class</a></li>
  288. <li class="toctree-l2"><a class="reference internal" href="sessions.html">Session Library</a></li>
  289. <li class="toctree-l2"><a class="reference internal" href="table.html">HTML Table Class</a></li>
  290. <li class="toctree-l2"><a class="reference internal" href="trackback.html">Trackback Class</a></li>
  291. <li class="toctree-l2"><a class="reference internal" href="typography.html">Typography Class</a></li>
  292. <li class="toctree-l2"><a class="reference internal" href="unit_testing.html">Unit Testing Class</a></li>
  293. <li class="toctree-l2"><a class="reference internal" href="uri.html">URI Class</a></li>
  294. <li class="toctree-l2"><a class="reference internal" href="user_agent.html">User Agent Class</a></li>
  295. <li class="toctree-l2"><a class="reference internal" href="xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
  296. <li class="toctree-l2"><a class="reference internal" href="zip.html">Zip Encoding Class</a></li>
  297. </ul>
  298. </li>
  299. </ul>
  300. <ul>
  301. <li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
  302. <li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
  303. <li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
  304. <li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
  305. <li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
  306. <li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
  307. <li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
  308. <li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
  309. <li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
  310. <li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
  311. <li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
  312. <li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
  313. <li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
  314. <li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
  315. <li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
  316. </ul>
  317. </li>
  318. </ul>
  319. <ul>
  320. <li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
  321. <li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
  322. <li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
  323. <li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
  324. <li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
  325. <li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
  326. <li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
  327. <li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
  328. <li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
  329. <li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
  330. <li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
  331. <li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
  332. <li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
  333. <li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
  334. <li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
  335. <li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
  336. <li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
  337. <li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
  338. <li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
  339. <li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
  340. <li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
  341. <li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
  342. </ul>
  343. </li>
  344. </ul>
  345. </div>
  346. &nbsp;
  347. </nav>
  348. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  349. <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
  350. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  351. <a href="../index.html">CodeIgniter</a>
  352. </nav>
  353. <div class="wy-nav-content">
  354. <div class="rst-content">
  355. <div role="navigation" aria-label="breadcrumbs navigation">
  356. <ul class="wy-breadcrumbs">
  357. <li><a href="../index.html">Docs</a> &raquo;</li>
  358. <li><a href="index.html">Libraries</a> &raquo;</li>
  359. <li>Loader Class</li>
  360. <li class="wy-breadcrumbs-aside">
  361. </li>
  362. <div style="float:right;margin-left:5px;" id="closeMe">
  363. <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" />
  364. </div>
  365. </ul>
  366. <hr/>
  367. </div>
  368. <div role="main" class="document">
  369. <div class="section" id="loader-class">
  370. <h1>Loader Class<a class="headerlink" href="#loader-class" title="Permalink to this headline">¶</a></h1>
  371. <p>Loader, as the name suggests, is used to load elements. These elements
  372. can be libraries (classes) <a class="reference internal" href="../general/views.html"><span class="doc">View files</span></a>,
  373. <a class="reference internal" href="../general/drivers.html"><span class="doc">Drivers</span></a>,
  374. <a class="reference internal" href="../general/helpers.html"><span class="doc">Helpers</span></a>,
  375. <a class="reference internal" href="../general/models.html"><span class="doc">Models</span></a>, or your own files.</p>
  376. <div class="admonition note">
  377. <p class="first admonition-title">Note</p>
  378. <p class="last">This class is initialized automatically by the system so there
  379. is no need to do it manually.</p>
  380. </div>
  381. <div class="contents local topic" id="contents">
  382. <ul class="simple">
  383. <li><a class="reference internal" href="#application-packages" id="id2">Application “Packages”</a><ul>
  384. <li><a class="reference internal" href="#package-view-files" id="id3">Package view files</a></li>
  385. </ul>
  386. </li>
  387. <li><a class="reference internal" href="#class-reference" id="id4">Class Reference</a></li>
  388. </ul>
  389. </div>
  390. <div class="custom-index container"></div><div class="section" id="application-packages">
  391. <h2><a class="toc-backref" href="#id2">Application “Packages”</a><a class="headerlink" href="#application-packages" title="Permalink to this headline">¶</a></h2>
  392. <p>An application package allows for the easy distribution of complete sets
  393. of resources in a single directory, complete with its own libraries,
  394. models, helpers, config, and language files. It is recommended that
  395. these packages be placed in the application/third_party directory. Below
  396. is a sample map of an package directory.</p>
  397. <p>The following is an example of a directory for an application package
  398. named “Foo Bar”.</p>
  399. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="o">/</span><span class="nx">application</span><span class="o">/</span><span class="nx">third_party</span><span class="o">/</span><span class="nx">foo_bar</span>
  400. <span class="nx">config</span><span class="o">/</span>
  401. <span class="nx">helpers</span><span class="o">/</span>
  402. <span class="nx">language</span><span class="o">/</span>
  403. <span class="nx">libraries</span><span class="o">/</span>
  404. <span class="nx">models</span><span class="o">/</span>
  405. </pre></div>
  406. </div>
  407. <p>Whatever the purpose of the “Foo Bar” application package, it has its
  408. own config files, helpers, language files, libraries, and models. To use
  409. these resources in your controllers, you first need to tell the Loader
  410. that you are going to be loading resources from a package, by adding the
  411. package path via the <code class="docutils literal"><span class="pre">add_package_path()</span></code> method.</p>
  412. <div class="section" id="package-view-files">
  413. <h3><a class="toc-backref" href="#id3">Package view files</a><a class="headerlink" href="#package-view-files" title="Permalink to this headline">¶</a></h3>
  414. <p>By Default, package view files paths are set when <code class="docutils literal"><span class="pre">add_package_path()</span></code>
  415. is called. View paths are looped through, and once a match is
  416. encountered that view is loaded.</p>
  417. <p>In this instance, it is possible for view naming collisions within
  418. packages to occur, and possibly the incorrect package being loaded. To
  419. ensure against this, set an optional second parameter of FALSE when
  420. calling <code class="docutils literal"><span class="pre">add_package_path()</span></code>.</p>
  421. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">add_package_path</span><span class="p">(</span><span class="nx">APPPATH</span><span class="o">.</span><span class="s1">&#39;my_app&#39;</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span>
  422. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">view</span><span class="p">(</span><span class="s1">&#39;my_app_index&#39;</span><span class="p">);</span> <span class="c1">// Loads</span>
  423. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">view</span><span class="p">(</span><span class="s1">&#39;welcome_message&#39;</span><span class="p">);</span> <span class="c1">// Will not load the default welcome_message b/c the second param to add_package_path is FALSE</span>
  424. <span class="c1">// Reset things</span>
  425. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">remove_package_path</span><span class="p">(</span><span class="nx">APPPATH</span><span class="o">.</span><span class="s1">&#39;my_app&#39;</span><span class="p">);</span>
  426. <span class="c1">// Again without the second parameter:</span>
  427. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">add_package_path</span><span class="p">(</span><span class="nx">APPPATH</span><span class="o">.</span><span class="s1">&#39;my_app&#39;</span><span class="p">);</span>
  428. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">view</span><span class="p">(</span><span class="s1">&#39;my_app_index&#39;</span><span class="p">);</span> <span class="c1">// Loads</span>
  429. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">view</span><span class="p">(</span><span class="s1">&#39;welcome_message&#39;</span><span class="p">);</span> <span class="c1">// Loads</span>
  430. </pre></div>
  431. </div>
  432. </div>
  433. </div>
  434. <div class="section" id="class-reference">
  435. <h2><a class="toc-backref" href="#id4">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline">¶</a></h2>
  436. <dl class="class">
  437. <dt id="CI_Loader">
  438. <em class="property">class </em><code class="descname">CI_Loader</code><a class="headerlink" href="#CI_Loader" title="Permalink to this definition">¶</a></dt>
  439. <dd><dl class="method">
  440. <dt id="CI_Loader::library">
  441. <code class="descname">library</code><span class="sig-paren">(</span><em>$library</em><span class="optional">[</span>, <em>$params = NULL</em><span class="optional">[</span>, <em>$object_name = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::library" title="Permalink to this definition">¶</a></dt>
  442. <dd><table class="docutils field-list" frame="void" rules="none">
  443. <col class="field-name" />
  444. <col class="field-body" />
  445. <tbody valign="top">
  446. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  447. <li><strong>$library</strong> (<em>mixed</em>) – Library name as a string or an array with multiple libraries</li>
  448. <li><strong>$params</strong> (<em>array</em>) – Optional array of parameters to pass to the loaded library’s constructor</li>
  449. <li><strong>$object_name</strong> (<em>string</em>) – Optional object name to assign the library to</li>
  450. </ul>
  451. </td>
  452. </tr>
  453. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Loader instance (method chaining)</p>
  454. </td>
  455. </tr>
  456. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Loader</p>
  457. </td>
  458. </tr>
  459. </tbody>
  460. </table>
  461. <p>This method is used to load core classes.</p>
  462. <div class="admonition note">
  463. <p class="first admonition-title">Note</p>
  464. <p class="last">We use the terms “class” and “library” interchangeably.</p>
  465. </div>
  466. <p>For example, if you would like to send email with CodeIgniter, the first
  467. step is to load the email class within your controller:</p>
  468. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;email&#39;</span><span class="p">);</span>
  469. </pre></div>
  470. </div>
  471. <p>Once loaded, the library will be ready for use, using <code class="docutils literal"><span class="pre">$this-&gt;email</span></code>.</p>
  472. <p>Library files can be stored in subdirectories within the main
  473. “libraries” directory, or within your personal <em>application/libraries</em>
  474. directory. To load a file located in a subdirectory, simply include the
  475. path, relative to the “libraries” directory. For example, if you have
  476. file located at:</p>
  477. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">libraries</span><span class="o">/</span><span class="nx">flavors</span><span class="o">/</span><span class="nx">Chocolate</span><span class="o">.</span><span class="nx">php</span>
  478. </pre></div>
  479. </div>
  480. <p>You will load it using:</p>
  481. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;flavors/chocolate&#39;</span><span class="p">);</span>
  482. </pre></div>
  483. </div>
  484. <p>You may nest the file in as many subdirectories as you want.</p>
  485. <p>Additionally, multiple libraries can be loaded at the same time by
  486. passing an array of libraries to the load method.</p>
  487. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">&#39;email&#39;</span><span class="p">,</span> <span class="s1">&#39;table&#39;</span><span class="p">));</span>
  488. </pre></div>
  489. </div>
  490. <p><strong>Setting options</strong></p>
  491. <p>The second (optional) parameter allows you to optionally pass
  492. configuration setting. You will typically pass these as an array:</p>
  493. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$config</span> <span class="o">=</span> <span class="k">array</span> <span class="p">(</span>
  494. <span class="s1">&#39;mailtype&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;html&#39;</span><span class="p">,</span>
  495. <span class="s1">&#39;charset&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;utf-8&#39;</span><span class="p">,</span>
  496. <span class="s1">&#39;priority&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;1&#39;</span>
  497. <span class="p">);</span>
  498. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;email&#39;</span><span class="p">,</span> <span class="nv">$config</span><span class="p">);</span>
  499. </pre></div>
  500. </div>
  501. <p>Config options can usually also be set via a config file. Each library
  502. is explained in detail in its own page, so please read the information
  503. regarding each one you would like to use.</p>
  504. <p>Please take note, when multiple libraries are supplied in an array for
  505. the first parameter, each will receive the same parameter information.</p>
  506. <p><strong>Assigning a Library to a different object name</strong></p>
  507. <p>If the third (optional) parameter is blank, the library will usually be
  508. assigned to an object with the same name as the library. For example, if
  509. the library is named Calendar, it will be assigned to a variable named
  510. <code class="docutils literal"><span class="pre">$this-&gt;calendar</span></code>.</p>
  511. <p>If you prefer to set your own class names you can pass its value to the
  512. third parameter:</p>
  513. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;calendar&#39;</span><span class="p">,</span> <span class="k">NULL</span><span class="p">,</span> <span class="s1">&#39;my_calendar&#39;</span><span class="p">);</span>
  514. <span class="c1">// Calendar class is now accessed using:</span>
  515. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">my_calendar</span>
  516. </pre></div>
  517. </div>
  518. <p>Please take note, when multiple libraries are supplied in an array for
  519. the first parameter, this parameter is discarded.</p>
  520. </dd></dl>
  521. <dl class="method">
  522. <dt id="CI_Loader::driver">
  523. <code class="descname">driver</code><span class="sig-paren">(</span><em>$library</em><span class="optional">[</span>, <em>$params = NULL</em><span class="optional">[</span>, <em>$object_name</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::driver" title="Permalink to this definition">¶</a></dt>
  524. <dd><table class="docutils field-list" frame="void" rules="none">
  525. <col class="field-name" />
  526. <col class="field-body" />
  527. <tbody valign="top">
  528. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  529. <li><strong>$library</strong> (<em>mixed</em>) – Library name as a string or an array with multiple libraries</li>
  530. <li><strong>$params</strong> (<em>array</em>) – Optional array of parameters to pass to the loaded library’s constructor</li>
  531. <li><strong>$object_name</strong> (<em>string</em>) – Optional object name to assign the library to</li>
  532. </ul>
  533. </td>
  534. </tr>
  535. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Loader instance (method chaining)</p>
  536. </td>
  537. </tr>
  538. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Loader</p>
  539. </td>
  540. </tr>
  541. </tbody>
  542. </table>
  543. <p>This method is used to load driver libraries, acts very much like the
  544. <code class="docutils literal"><span class="pre">library()</span></code> method.</p>
  545. <p>As an example, if you would like to use sessions with CodeIgniter, the first
  546. step is to load the session driver within your controller:</p>
  547. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">driver</span><span class="p">(</span><span class="s1">&#39;session&#39;</span><span class="p">);</span>
  548. </pre></div>
  549. </div>
  550. <p>Once loaded, the library will be ready for use, using <code class="docutils literal"><span class="pre">$this-&gt;session</span></code>.</p>
  551. <p>Driver files must be stored in a subdirectory within the main
  552. “libraries” directory, or within your personal <em>application/libraries</em>
  553. directory. The subdirectory must match the parent class name. Read the
  554. <a class="reference internal" href="../general/drivers.html"><span class="doc">Drivers</span></a> description for details.</p>
  555. <p>Additionally, multiple driver libraries can be loaded at the same time by
  556. passing an array of drivers to the load method.</p>
  557. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">driver</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">&#39;session&#39;</span><span class="p">,</span> <span class="s1">&#39;cache&#39;</span><span class="p">));</span>
  558. </pre></div>
  559. </div>
  560. <p><strong>Setting options</strong></p>
  561. <p>The second (optional) parameter allows you to optionally pass
  562. configuration settings. You will typically pass these as an array:</p>
  563. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$config</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
  564. <span class="s1">&#39;sess_driver&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;cookie&#39;</span><span class="p">,</span>
  565. <span class="s1">&#39;sess_encrypt_cookie&#39;</span> <span class="o">=&gt;</span> <span class="k">true</span><span class="p">,</span>
  566. <span class="s1">&#39;encryption_key&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;mysecretkey&#39;</span>
  567. <span class="p">);</span>
  568. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">driver</span><span class="p">(</span><span class="s1">&#39;session&#39;</span><span class="p">,</span> <span class="nv">$config</span><span class="p">);</span>
  569. </pre></div>
  570. </div>
  571. <p>Config options can usually also be set via a config file. Each library
  572. is explained in detail in its own page, so please read the information
  573. regarding each one you would like to use.</p>
  574. <p><strong>Assigning a Driver to a different object name</strong></p>
  575. <p>If the third (optional) parameter is blank, the library will be assigned
  576. to an object with the same name as the parent class. For example, if
  577. the library is named Session, it will be assigned to a variable named
  578. <code class="docutils literal"><span class="pre">$this-&gt;session</span></code>.</p>
  579. <p>If you prefer to set your own class names you can pass its value to the
  580. third parameter:</p>
  581. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;session&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="s1">&#39;my_session&#39;</span><span class="p">);</span>
  582. <span class="c1">// Session class is now accessed using:</span>
  583. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">my_session</span>
  584. </pre></div>
  585. </div>
  586. </dd></dl>
  587. <dl class="method">
  588. <dt id="CI_Loader::view">
  589. <code class="descname">view</code><span class="sig-paren">(</span><em>$view</em><span class="optional">[</span>, <em>$vars = array()</em><span class="optional">[</span>, <em>return = FALSE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::view" title="Permalink to this definition">¶</a></dt>
  590. <dd><table class="docutils field-list" frame="void" rules="none">
  591. <col class="field-name" />
  592. <col class="field-body" />
  593. <tbody valign="top">
  594. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  595. <li><strong>$view</strong> (<em>string</em>) – View name</li>
  596. <li><strong>$vars</strong> (<em>array</em>) – An associative array of variables</li>
  597. <li><strong>$return</strong> (<em>bool</em>) – Whether to return the loaded view</li>
  598. </ul>
  599. </td>
  600. </tr>
  601. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">View content string if $return is set to TRUE, otherwise CI_Loader instance (method chaining)</p>
  602. </td>
  603. </tr>
  604. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
  605. </td>
  606. </tr>
  607. </tbody>
  608. </table>
  609. <p>This method is used to load your View files. If you haven’t read the
  610. <a class="reference internal" href="../general/views.html"><span class="doc">Views</span></a> section of the user guide it is
  611. recommended that you do since it shows you how this method is
  612. typically used.</p>
  613. <p>The first parameter is required. It is the name of the view file you
  614. would like to load.</p>
  615. <div class="admonition note">
  616. <p class="first admonition-title">Note</p>
  617. <p class="last">The .php file extension does not need to be specified unless
  618. you use something other than .php.</p>
  619. </div>
  620. <p>The second <strong>optional</strong> parameter can take an associative array or an
  621. object as input, which it runs through the PHP
  622. <a class="reference external" href="http://php.net/extract">extract()</a> function to convert to variables
  623. that can be used in your view files. Again, read the
  624. <a class="reference internal" href="../general/views.html"><span class="doc">Views</span></a> page to learn how this might be useful.</p>
  625. <p>The third <strong>optional</strong> parameter lets you change the behavior of the
  626. method so that it returns data as a string rather than sending it to
  627. your browser. This can be useful if you want to process the data in some
  628. way. If you set the parameter to TRUE (boolean) it will return data. The
  629. default behavior is FALSE, which sends it to your browser. Remember to
  630. assign it to a variable if you want the data returned:</p>
  631. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$string</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">view</span><span class="p">(</span><span class="s1">&#39;myfile&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span>
  632. </pre></div>
  633. </div>
  634. </dd></dl>
  635. <dl class="method">
  636. <dt id="CI_Loader::vars">
  637. <code class="descname">vars</code><span class="sig-paren">(</span><em>$vars</em><span class="optional">[</span>, <em>$val = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::vars" title="Permalink to this definition">¶</a></dt>
  638. <dd><table class="docutils field-list" frame="void" rules="none">
  639. <col class="field-name" />
  640. <col class="field-body" />
  641. <tbody valign="top">
  642. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  643. <li><strong>$vars</strong> (<em>mixed</em>) – An array of variables or a single variable name</li>
  644. <li><strong>$val</strong> (<em>mixed</em>) – Optional variable value</li>
  645. </ul>
  646. </td>
  647. </tr>
  648. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Loader instance (method chaining)</p>
  649. </td>
  650. </tr>
  651. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Loader</p>
  652. </td>
  653. </tr>
  654. </tbody>
  655. </table>
  656. <p>This method takes an associative array as input and generates
  657. variables using the PHP <a class="reference external" href="http://php.net/extract">extract()</a>
  658. function. This method produces the same result as using the second
  659. parameter of the <code class="docutils literal"><span class="pre">$this-&gt;load-&gt;view()</span></code> method above. The reason you
  660. might want to use this method independently is if you would like to
  661. set some global variables in the constructor of your controller and have
  662. them become available in any view file loaded from any method. You can
  663. have multiple calls to this method. The data get cached and merged
  664. into one array for conversion to variables.</p>
  665. </dd></dl>
  666. <dl class="method">
  667. <dt id="CI_Loader::get_var">
  668. <code class="descname">get_var</code><span class="sig-paren">(</span><em>$key</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::get_var" title="Permalink to this definition">¶</a></dt>
  669. <dd><table class="docutils field-list" frame="void" rules="none">
  670. <col class="field-name" />
  671. <col class="field-body" />
  672. <tbody valign="top">
  673. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  674. <li><strong>$key</strong> (<em>string</em>) – Variable name key</li>
  675. </ul>
  676. </td>
  677. </tr>
  678. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Value if key is found, NULL if not</p>
  679. </td>
  680. </tr>
  681. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
  682. </td>
  683. </tr>
  684. </tbody>
  685. </table>
  686. <p>This method checks the associative array of variables available to
  687. your views. This is useful if for any reason a var is set in a library
  688. or another controller method using <code class="docutils literal"><span class="pre">$this-&gt;load-&gt;vars()</span></code>.</p>
  689. </dd></dl>
  690. <dl class="method">
  691. <dt id="CI_Loader::get_vars">
  692. <code class="descname">get_vars</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::get_vars" title="Permalink to this definition">¶</a></dt>
  693. <dd><table class="docutils field-list" frame="void" rules="none">
  694. <col class="field-name" />
  695. <col class="field-body" />
  696. <tbody valign="top">
  697. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">An array of all assigned view variables</td>
  698. </tr>
  699. <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
  700. </tr>
  701. </tbody>
  702. </table>
  703. <p>This method retrieves all variables available to your views.</p>
  704. </dd></dl>
  705. <dl class="method">
  706. <dt id="CI_Loader::clear_vars">
  707. <code class="descname">clear_vars</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::clear_vars" title="Permalink to this definition">¶</a></dt>
  708. <dd><table class="docutils field-list" frame="void" rules="none">
  709. <col class="field-name" />
  710. <col class="field-body" />
  711. <tbody valign="top">
  712. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_Loader instance (method chaining)</td>
  713. </tr>
  714. <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_Loader</td>
  715. </tr>
  716. </tbody>
  717. </table>
  718. <p>Clears cached view variables.</p>
  719. </dd></dl>
  720. <dl class="method">
  721. <dt id="CI_Loader::model">
  722. <code class="descname">model</code><span class="sig-paren">(</span><em>$model</em><span class="optional">[</span>, <em>$name = ''</em><span class="optional">[</span>, <em>$db_conn = FALSE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::model" title="Permalink to this definition">¶</a></dt>
  723. <dd><table class="docutils field-list" frame="void" rules="none">
  724. <col class="field-name" />
  725. <col class="field-body" />
  726. <tbody valign="top">
  727. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  728. <li><strong>$model</strong> (<em>mixed</em>) – Model name or an array containing multiple models</li>
  729. <li><strong>$name</strong> (<em>string</em>) – Optional object name to assign the model to</li>
  730. <li><strong>$db_conn</strong> (<em>string</em>) – Optional database configuration group to load</li>
  731. </ul>
  732. </td>
  733. </tr>
  734. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Loader instance (method chaining)</p>
  735. </td>
  736. </tr>
  737. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Loader</p>
  738. </td>
  739. </tr>
  740. </tbody>
  741. </table>
  742. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">model</span><span class="p">(</span><span class="s1">&#39;model_name&#39;</span><span class="p">);</span>
  743. </pre></div>
  744. </div>
  745. <p>If your model is located in a subdirectory, include the relative path
  746. from your models directory. For example, if you have a model located at
  747. <em>application/models/blog/Queries.php</em> you’ll load it using:</p>
  748. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">model</span><span class="p">(</span><span class="s1">&#39;blog/queries&#39;</span><span class="p">);</span>
  749. </pre></div>
  750. </div>
  751. <p>If you would like your model assigned to a different object name you can
  752. specify it via the second parameter of the loading method:</p>
  753. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">model</span><span class="p">(</span><span class="s1">&#39;model_name&#39;</span><span class="p">,</span> <span class="s1">&#39;fubar&#39;</span><span class="p">);</span>
  754. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">fubar</span><span class="o">-&gt;</span><span class="na">method</span><span class="p">();</span>
  755. </pre></div>
  756. </div>
  757. </dd></dl>
  758. <dl class="method">
  759. <dt id="CI_Loader::database">
  760. <code class="descname">database</code><span class="sig-paren">(</span><span class="optional">[</span><em>$params = ''</em><span class="optional">[</span>, <em>$return = FALSE</em><span class="optional">[</span>, <em>$query_builder = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::database" title="Permalink to this definition">¶</a></dt>
  761. <dd><table class="docutils field-list" frame="void" rules="none">
  762. <col class="field-name" />
  763. <col class="field-body" />
  764. <tbody valign="top">
  765. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  766. <li><strong>$params</strong> (<em>mixed</em>) – Database group name or configuration options</li>
  767. <li><strong>$return</strong> (<em>bool</em>) – Whether to return the loaded database object</li>
  768. <li><strong>$query_builder</strong> (<em>bool</em>) – Whether to load the Query Builder</li>
  769. </ul>
  770. </td>
  771. </tr>
  772. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Loaded CI_DB instance or FALSE on failure if $return is set to TRUE, otherwise CI_Loader instance (method chaining)</p>
  773. </td>
  774. </tr>
  775. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
  776. </td>
  777. </tr>
  778. </tbody>
  779. </table>
  780. <p>This method lets you load the database class. The two parameters are
  781. <strong>optional</strong>. Please see the <a class="reference internal" href="../database/index.html"><span class="doc">database</span></a>
  782. section for more info.</p>
  783. </dd></dl>
  784. <dl class="method">
  785. <dt id="CI_Loader::dbforge">
  786. <code class="descname">dbforge</code><span class="sig-paren">(</span><span class="optional">[</span><em>$db = NULL</em><span class="optional">[</span>, <em>$return = FALSE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::dbforge" title="Permalink to this definition">¶</a></dt>
  787. <dd><table class="docutils field-list" frame="void" rules="none">
  788. <col class="field-name" />
  789. <col class="field-body" />
  790. <tbody valign="top">
  791. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  792. <li><strong>$db</strong> (<em>object</em>) – Database object</li>
  793. <li><strong>$return</strong> (<em>bool</em>) – Whether to return the Database Forge instance</li>
  794. </ul>
  795. </td>
  796. </tr>
  797. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Loaded CI_DB_forge instance if $return is set to TRUE, otherwise CI_Loader instance (method chaining)</p>
  798. </td>
  799. </tr>
  800. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
  801. </td>
  802. </tr>
  803. </tbody>
  804. </table>
  805. <p>Loads the <a class="reference internal" href="../database/forge.html"><span class="doc">Database Forge</span></a> class, please refer
  806. to that manual for more info.</p>
  807. </dd></dl>
  808. <dl class="method">
  809. <dt id="CI_Loader::dbutil">
  810. <code class="descname">dbutil</code><span class="sig-paren">(</span><span class="optional">[</span><em>$db = NULL</em><span class="optional">[</span>, <em>$return = FALSE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::dbutil" title="Permalink to this definition">¶</a></dt>
  811. <dd><table class="docutils field-list" frame="void" rules="none">
  812. <col class="field-name" />
  813. <col class="field-body" />
  814. <tbody valign="top">
  815. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  816. <li><strong>$db</strong> (<em>object</em>) – Database object</li>
  817. <li><strong>$return</strong> (<em>bool</em>) – Whether to return the Database Utilities instance</li>
  818. </ul>
  819. </td>
  820. </tr>
  821. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Loaded CI_DB_utility instance if $return is set to TRUE, otherwise CI_Loader instance (method chaining)</p>
  822. </td>
  823. </tr>
  824. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
  825. </td>
  826. </tr>
  827. </tbody>
  828. </table>
  829. <p>Loads the <a class="reference internal" href="../database/utilities.html"><span class="doc">Database Utilities</span></a> class, please
  830. refer to that manual for more info.</p>
  831. </dd></dl>
  832. <dl class="method">
  833. <dt id="CI_Loader::helper">
  834. <code class="descname">helper</code><span class="sig-paren">(</span><em>$helpers</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::helper" title="Permalink to this definition">¶</a></dt>
  835. <dd><table class="docutils field-list" frame="void" rules="none">
  836. <col class="field-name" />
  837. <col class="field-body" />
  838. <tbody valign="top">
  839. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  840. <li><strong>$helpers</strong> (<em>mixed</em>) – Helper name as a string or an array containing multiple helpers</li>
  841. </ul>
  842. </td>
  843. </tr>
  844. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Loader instance (method chaining)</p>
  845. </td>
  846. </tr>
  847. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Loader</p>
  848. </td>
  849. </tr>
  850. </tbody>
  851. </table>
  852. <p>This method loads helper files, where file_name is the name of the
  853. file, without the _helper.php extension.</p>
  854. </dd></dl>
  855. <dl class="method">
  856. <dt id="CI_Loader::file">
  857. <code class="descname">file</code><span class="sig-paren">(</span><em>$path</em><span class="optional">[</span>, <em>$return = FALSE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::file" title="Permalink to this definition">¶</a></dt>
  858. <dd><table class="docutils field-list" frame="void" rules="none">
  859. <col class="field-name" />
  860. <col class="field-body" />
  861. <tbody valign="top">
  862. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  863. <li><strong>$path</strong> (<em>string</em>) – File path</li>
  864. <li><strong>$return</strong> (<em>bool</em>) – Whether to return the loaded file</li>
  865. </ul>
  866. </td>
  867. </tr>
  868. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">File contents if $return is set to TRUE, otherwise CI_Loader instance (method chaining)</p>
  869. </td>
  870. </tr>
  871. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
  872. </td>
  873. </tr>
  874. </tbody>
  875. </table>
  876. <p>This is a generic file loading method. Supply the filepath and name in
  877. the first parameter and it will open and read the file. By default the
  878. data is sent to your browser, just like a View file, but if you set the
  879. second parameter to boolean TRUE it will instead return the data as a
  880. string.</p>
  881. </dd></dl>
  882. <dl class="method">
  883. <dt id="CI_Loader::language">
  884. <code class="descname">language</code><span class="sig-paren">(</span><em>$files</em><span class="optional">[</span>, <em>$lang = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::language" title="Permalink to this definition">¶</a></dt>
  885. <dd><table class="docutils field-list" frame="void" rules="none">
  886. <col class="field-name" />
  887. <col class="field-body" />
  888. <tbody valign="top">
  889. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  890. <li><strong>$files</strong> (<em>mixed</em>) – Language file name or an array of multiple language files</li>
  891. <li><strong>$lang</strong> (<em>string</em>) – Language name</li>
  892. </ul>
  893. </td>
  894. </tr>
  895. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Loader instance (method chaining)</p>
  896. </td>
  897. </tr>
  898. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Loader</p>
  899. </td>
  900. </tr>
  901. </tbody>
  902. </table>
  903. <p>This method is an alias of the <a class="reference internal" href="language.html"><span class="doc">language loading
  904. method</span></a>: <code class="docutils literal"><span class="pre">$this-&gt;lang-&gt;load()</span></code>.</p>
  905. </dd></dl>
  906. <dl class="method">
  907. <dt id="CI_Loader::config">
  908. <code class="descname">config</code><span class="sig-paren">(</span><em>$file</em><span class="optional">[</span>, <em>$use_sections = FALSE</em><span class="optional">[</span>, <em>$fail_gracefully = FALSE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::config" title="Permalink to this definition">¶</a></dt>
  909. <dd><table class="docutils field-list" frame="void" rules="none">
  910. <col class="field-name" />
  911. <col class="field-body" />
  912. <tbody valign="top">
  913. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  914. <li><strong>$file</strong> (<em>string</em>) – Configuration file name</li>
  915. <li><strong>$use_sections</strong> (<em>bool</em>) – Whether configuration values should be loaded into their own section</li>
  916. <li><strong>$fail_gracefully</strong> (<em>bool</em>) – Whether to just return FALSE in case of failure</li>
  917. </ul>
  918. </td>
  919. </tr>
  920. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
  921. </td>
  922. </tr>
  923. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
  924. </td>
  925. </tr>
  926. </tbody>
  927. </table>
  928. <p>This method is an alias of the <a class="reference internal" href="config.html"><span class="doc">config file loading
  929. method</span></a>: <code class="docutils literal"><span class="pre">$this-&gt;config-&gt;load()</span></code></p>
  930. </dd></dl>
  931. <dl class="method">
  932. <dt id="CI_Loader::is_loaded">
  933. <code class="descname">is_loaded</code><span class="sig-paren">(</span><em>$class</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::is_loaded" title="Permalink to this definition">¶</a></dt>
  934. <dd><table class="docutils field-list" frame="void" rules="none">
  935. <col class="field-name" />
  936. <col class="field-body" />
  937. <tbody valign="top">
  938. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  939. <li><strong>$class</strong> (<em>string</em>) – Class name</li>
  940. </ul>
  941. </td>
  942. </tr>
  943. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Singleton property name if found, FALSE if not</p>
  944. </td>
  945. </tr>
  946. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
  947. </td>
  948. </tr>
  949. </tbody>
  950. </table>
  951. <p>Allows you to check if a class has already been loaded or not.</p>
  952. <div class="admonition note">
  953. <p class="first admonition-title">Note</p>
  954. <p class="last">The word “class” here refers to libraries and drivers.</p>
  955. </div>
  956. <p>If the requested class has been loaded, the method returns its assigned
  957. name in the CI Super-object and FALSE if it’s not:</p>
  958. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;form_validation&#39;</span><span class="p">);</span>
  959. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">is_loaded</span><span class="p">(</span><span class="s1">&#39;Form_validation&#39;</span><span class="p">);</span> <span class="c1">// returns &#39;form_validation&#39;</span>
  960. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">is_loaded</span><span class="p">(</span><span class="s1">&#39;Nonexistent_library&#39;</span><span class="p">);</span> <span class="c1">// returns FALSE</span>
  961. </pre></div>
  962. </div>
  963. <div class="admonition important">
  964. <p class="first admonition-title">Important</p>
  965. <p class="last">If you have more than one instance of a class (assigned to
  966. different properties), then the first one will be returned.</p>
  967. </div>
  968. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;form_validation&#39;</span><span class="p">,</span> <span class="nv">$config</span><span class="p">,</span> <span class="s1">&#39;fv&#39;</span><span class="p">);</span>
  969. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;form_validation&#39;</span><span class="p">);</span>
  970. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">is_loaded</span><span class="p">(</span><span class="s1">&#39;Form_validation&#39;</span><span class="p">);</span> <span class="c1">// returns &#39;fv&#39;</span>
  971. </pre></div>
  972. </div>
  973. </dd></dl>
  974. <dl class="method">
  975. <dt id="CI_Loader::add_package_path">
  976. <code class="descname">add_package_path</code><span class="sig-paren">(</span><em>$path</em><span class="optional">[</span>, <em>$view_cascade = TRUE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::add_package_path" title="Permalink to this definition">¶</a></dt>
  977. <dd><table class="docutils field-list" frame="void" rules="none">
  978. <col class="field-name" />
  979. <col class="field-body" />
  980. <tbody valign="top">
  981. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  982. <li><strong>$path</strong> (<em>string</em>) – Path to add</li>
  983. <li><strong>$view_cascade</strong> (<em>bool</em>) – Whether to use cascading views</li>
  984. </ul>
  985. </td>
  986. </tr>
  987. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Loader instance (method chaining)</p>
  988. </td>
  989. </tr>
  990. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Loader</p>
  991. </td>
  992. </tr>
  993. </tbody>
  994. </table>
  995. <p>Adding a package path instructs the Loader class to prepend a given path
  996. for subsequent requests for resources. As an example, the “Foo Bar”
  997. application package above has a library named Foo_bar.php. In our
  998. controller, we’d do the following:</p>
  999. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">add_package_path</span><span class="p">(</span><span class="nx">APPPATH</span><span class="o">.</span><span class="s1">&#39;third_party/foo_bar/&#39;</span><span class="p">)</span>
  1000. <span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;foo_bar&#39;</span><span class="p">);</span>
  1001. </pre></div>
  1002. </div>
  1003. </dd></dl>
  1004. <dl class="method">
  1005. <dt id="CI_Loader::remove_package_path">
  1006. <code class="descname">remove_package_path</code><span class="sig-paren">(</span><span class="optional">[</span><em>$path = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::remove_package_path" title="Permalink to this definition">¶</a></dt>
  1007. <dd><table class="docutils field-list" frame="void" rules="none">
  1008. <col class="field-name" />
  1009. <col class="field-body" />
  1010. <tbody valign="top">
  1011. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1012. <li><strong>$path</strong> (<em>string</em>) – Path to remove</li>
  1013. </ul>
  1014. </td>
  1015. </tr>
  1016. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Loader instance (method chaining)</p>
  1017. </td>
  1018. </tr>
  1019. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Loader</p>
  1020. </td>
  1021. </tr>
  1022. </tbody>
  1023. </table>
  1024. <p>When your controller is finished using resources from an application
  1025. package, and particularly if you have other application packages you
  1026. want to work with, you may wish to remove the package path so the Loader
  1027. no longer looks in that directory for resources. To remove the last path
  1028. added, simply call the method with no parameters.</p>
  1029. <p>Or to remove a specific package path, specify the same path previously
  1030. given to <code class="docutils literal"><span class="pre">add_package_path()</span></code> for a package.:</p>
  1031. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">remove_package_path</span><span class="p">(</span><span class="nx">APPPATH</span><span class="o">.</span><span class="s1">&#39;third_party/foo_bar/&#39;</span><span class="p">);</span>
  1032. </pre></div>
  1033. </div>
  1034. </dd></dl>
  1035. <dl class="method">
  1036. <dt id="CI_Loader::get_package_paths">
  1037. <code class="descname">get_package_paths</code><span class="sig-paren">(</span><span class="optional">[</span><em>$include_base = TRUE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Loader::get_package_paths" title="Permalink to this definition">¶</a></dt>
  1038. <dd><table class="docutils field-list" frame="void" rules="none">
  1039. <col class="field-name" />
  1040. <col class="field-body" />
  1041. <tbody valign="top">
  1042. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1043. <li><strong>$include_base</strong> (<em>bool</em>) – Whether to include BASEPATH</li>
  1044. </ul>
  1045. </td>
  1046. </tr>
  1047. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An array of package paths</p>
  1048. </td>
  1049. </tr>
  1050. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
  1051. </td>
  1052. </tr>
  1053. </tbody>
  1054. </table>
  1055. <p>Returns all currently available package paths.</p>
  1056. </dd></dl>
  1057. </dd></dl>
  1058. </div>
  1059. </div>
  1060. </div>
  1061. <footer>
  1062. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  1063. <a href="migration.html" class="btn btn-neutral float-right" title="Migrations Class">Next <span class="fa fa-arrow-circle-right"></span></a>
  1064. <a href="language.html" class="btn btn-neutral" title="Language Class"><span class="fa fa-arrow-circle-left"></span> Previous</a>
  1065. </div>
  1066. <hr/>
  1067. <div role="contentinfo">
  1068. <p>
  1069. &copy; Copyright 2014 - 2019, British Columbia Institute of Technology.
  1070. Last updated on Sep 19, 2019.
  1071. </p>
  1072. </div>
  1073. Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
  1074. </footer>
  1075. </div>
  1076. </div>
  1077. </section>
  1078. </div>
  1079. <script type="text/javascript">
  1080. var DOCUMENTATION_OPTIONS = {
  1081. URL_ROOT:'../',
  1082. VERSION:'3.1.11',
  1083. COLLAPSE_INDEX:false,
  1084. FILE_SUFFIX:'.html',
  1085. HAS_SOURCE: false
  1086. };
  1087. </script>
  1088. <script type="text/javascript" src="../_static/jquery.js"></script>
  1089. <script type="text/javascript" src="../_static/underscore.js"></script>
  1090. <script type="text/javascript" src="../_static/doctools.js"></script>
  1091. <script type="text/javascript" src="../_static/js/theme.js"></script>
  1092. <script type="text/javascript">
  1093. jQuery(function () {
  1094. SphinxRtdTheme.StickyNav.enable();
  1095. });
  1096. </script>
  1097. </body>
  1098. </html>