English 中文(简体)
CodeIgniter - Application Architecture
  • 时间:2024-11-03

CodeIgniter - Apppcation Architecture


Previous Page Next Page  

The architecture of CodeIgniter apppcation is shown below.

Architecture of CodeIgniter

    As shown in the figure, whenever a request comes to CodeIgniter, it will first go to index.php page.

    In the second step, Routing will decide whether to pass this request to step-3 for caching or to pass this request to step-4 for security check.

    If the requested page is already in Caching, then Routing will pass the request to step-3 and the response will go back to the user.

    If the requested page does not exist in Caching, then Routing will pass the requested page to step-4 for Security checks.

    Before passing the request to Apppcation Controller, the Security of the submitted data is checked. After the Security check, the Apppcation Controller loads necessary Models, Libraries, Helpers, Plugins and Scripts and pass it on to View.

    The View will render the page with available data and pass it on for Caching. As the requested page was not cached before so this time it will be cached in Caching, to process this page quickly for future requests.

Directory Structure

The image given below shows the directory structure of the CodeIgniter.

Directory Structure

CodeIgniter directory structure is spanided into 3 folders −

    Apppcation

    System

    User_guide

Apppcation

As the name indicates the Apppcation folder contains all the code of your apppcation that you are building. This is the folder where you will develop your project. The Apppcation folder contains several other folders, which are explained below −

    Cache − This folder contains all the cached pages of your apppcation. These cached pages will increase the overall speed of accessing the pages.

    Config − This folder contains various files to configure the apppcation. With the help of config.php file, user can configure the apppcation. Using database.php file, user can configure the database of the apppcation.

    Controllers − This folder holds the controllers of your apppcation. It is the basic part of your apppcation.

    Core − This folder will contain base class of your apppcation.

    Helpers − In this folder, you can put helper class of your apppcation.

    Hooks − The files in this folder provide a means to tap into and modify the inner workings of the framework without hacking the core files.

    Language − This folder contains language related files.

    Libraries − This folder contains files of the pbraries developed for your apppcation.

    Logs − This folder contains files related to the log of the system.

    Models − The database login will be placed in this folder.

    Third_party − In this folder, you can place any plugins, which will be used for your apppcation.

    Views − Apppcation’s HTML files will be placed in this folder.

System

This folder contains CodeIgniter core codes, pbraries, helpers and other files, which help make the coding easy. These pbraries and helpers are loaded and used in web app development.

This folder contains all the CodeIgniter code of consequence, organized into various folders −

    Core − This folder contains CodeIgniter’s core class. Do not modify anything here. All of your work will take place in the apppcation folder. Even if your intent is to extend the CodeIgniter core, you have to do it with hooks, and hooks pve in the apppcation folder.

    Database − The database folder contains core database drivers and other database utipties.

    Fonts − The fonts folder contains font related information and utipties.

    Helpers − The helpers folder contains standard CodeIgniter helpers (such as date, cookie, and URL helpers).

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

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

User_guide

This is your user guide to CodeIgniter. It is basically, the offpne version of user guide on CodeIgniter website. Using this, one can learn the functions of various pbraries, helpers and classes. It is recommended to go through this user guide before building your first web app in CodeIgniter.

Beside these three folders, there is one more important file named “index.php”. In this file, we can set the apppcation environment and error level and we can define system and apppcation folder name. It is recommended, not to edit these settings if you do not have enough knowledge about what you are going to do.

Advertisements