Professional CodeIgniter

(singke) #1

Chapter 3: A 10,000 - Foot View of CodeIgniter


49


plugins — The plugins folder contains plugins. Plugins and helpers are very similar, in that they
both allow developers to quickly address an issue or create content (like forms, links, etc.).
However, the main difference between them is that plugins usually consist of one function,
while helpers often have many functions bundled inside them.

The system/application Folder


The most important folder, the one that deserves most of your attention, is the /system/application
folder and all of its subfolders. Ninety - nine percent of your work will be done right in this folder, so it
deserves a bit of attention at this point. Learning “what goes where” now, will reduce confusion later.

The system/application folder is broken down into several folders:

config — The config folder contains several important files that control your configuration
options. There are files that manage your database setup and other variables that CodeIgniter
needs to know about (such as the base URL, which libraries and helpers to autoload, etc.).

controllers — The controllers folder contains the controllers you create for your application.

errors — The errors folder comes with standard CodeIgniter error templates for 404 pages, PHP
errors, and others. You are free to modify these templates to make them fit the look and feel of
your application.

hooks — The hooks folder contains any hooks you create for your application. Hooks, as
mentioned above, are the best way to safely extend the CodeIgniter core.

libraries — The libraries folder contains custom libraries you create for your application. Do not
confuse this folder (which you use to store your own custom libraries) with the system/libraries
folder (which contains the core CodeIgniter libraries).

models — The models folder contains the models you create for your application.

views — The views folder contains the views you create for your application.

In other words, the most important folders in /system/application are controllers/, models/, and
views/. If you spend 99 percent of your time inside this folder, you ’ ll spend 99 percent of that time with
models, views, and controllers that you build.

The other very important folder is config/, which contains various important configuration files. You ’ ll
want to open them in an editor for tweaking before starting any project. Because these files are so
important, you ’ ll need to know about them in detail.

Initial Configuration


In this section, you learn the ins and outs of the files inside the system/application/config/ folder. This
folder contains an assortment of files (including the index.html file). Of those files, four of them are
important enough to warrant attention now. Those files, in order of importance for your project, are :

config.php

database.php

❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑

Free download pdf