Professional CodeIgniter

(singke) #1

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


48


Here ’ s what that .htaccess file would look like. It basically contains instructions that allows certain files
and folders to be viewable on the web site:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

If you are familiar with mod_rewrite in Apache, you will note that this rule ostensibly removes index
.php from the URL of any destination. Below, when you ’ re configuring CodeIgniter (and particularly the
config.php file), you ’ ll see why this is a good idea.

If you ’ re not familiar with mod_rewrite in Apache, don ’ t be too intimidated by this file. Basically, the
.htaccess file sets forth a few rules, one of which removes index.php from all URLs. Other rules in the file
allow the use of various other folders that you will need going forward (such as folders that contain CSS,
JavaScript, Captcha files, and images).

The system/ Folder


The system/ folder is where all the action happens. This folder contains all the CodeIgniter code of
consequence, organized into various folders:

application — The application folder contains the application you ’ re building. Basically, this
folder contains your models, views, controllers, and other code (like helpers and class
extensions). In other words, this folder is where you ’ ll do 99 percent of your work.

cache — The cache folder contains all cached pages for your application. In Chapter 9 , you learn
more about caching and how to turn your super - speedy development application into a
blazingly fast live application.

codeigniter — The codeigniter folder is where CodeIgniter ’ s core classes live. You have almost no
reason to go in here. All of your work will occur in the application folder. Even if your intent is
to extend the CodeIgniter core, you would do it with hooks, and hooks live in the application
folder.

database — The database folder contains core database drivers and other database utilities. Again,
there ’ s no good reason for you to be in this folder.

fonts — The fonts folder contains font - related information and utilities. Again, there ’ s no reason
to spend any time here.

helpers — The helpers folder contains standard CodeIgniter helpers (such as date, cookie, and
URL helpers). You ’ ll make frequent use of helpers in your CodeIgniter career and can even
extend helpers thanks to improvements introduced in CodeIgniter version 1.6.

language — The language folder contains language files. You can ignore it for now.

libraries — The libraries folder contains standard CodeIgniter libraries (to help you with e - mail,
calendars, file uploads, and more). You can create your own libraries or extend (and even
replace) standard ones, but those will be saved in the application/libraries directory to keep
them separate from the standard CodeIgniter libraries saved in this particular folder.

logs — The logs folder is the folder CodeIgniter uses to write error and other logs to.

❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑

Free download pdf