background preloader

Framework

Facebook Twitter

Symfony. CakePHP. CodeIgniter. A Brief History 2006: CodeIgniter was born.

CodeIgniter

CodeIgniter is a powerful open-source PHP framework with a very small footprint, created by Rick Ellis in 2006. CodeIgniter was born from ExpressionEngine, essentially a collection of refactored classes originally written for EllisLab's flagship CMS. Stripped of the application-specific functionality, CodeIgniter was made to be a simple and elegant toolkit, enabling rapid development of both web sites and web applications, attracting thousands of talented PHP developers. 2008: Industry leader. 2009: ExpressionEngine 2.0. Where is CodeIgniter Now? 2014: BCIT Stewardship. Liste des fonctions. Config Class. The Config class provides a means to retrieve configuration preferences.

Config Class

These preferences can come from the default config file (application/config/config.php) or from your own custom config files. Note: This class is initialized automatically by the system so there is no need to do it manually. Anatomy of a Config File By default, CodeIgniter has one primary config file, located at application/config/config.php. If you open the file using your text editor you'll see that config items are stored in an array called . You can add your own config items to this file, or if you prefer to keep your configuration items separate (assuming you even need config items), simply create your own file and save it in config folder. Note: If you do create your own config files use the same format as the primary one, storing your items in an array called . Loading a Config File There are two ways to load a config file: Fetching Config Items To retrieve an item from your config file, use the following function: Session Class. The Session class permits you maintain a user's "state" and track their activity while they browse your site.

Session Class

The Session class stores session information for each user as serialized (and optionally encrypted) data in a cookie. It can also store the session data in a database table for added security, as this permits the session ID in the user's cookie to be matched against the stored session ID. By default only the cookie is saved. If you choose to use the database option you'll need to create the session table as indicated below. The Database Class. Form Validation. CodeIgniter provides a comprehensive form validation and data prepping class that helps minimize the amount of code you'll write.

Form Validation

Before explaining CodeIgniter's approach to data validation, let's describe the ideal scenario: A form is displayed.You fill it in and submit it.If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data along with an error message describing the problem.This process continues until you have submitted a valid form.

On the receiving end, the script must: Check for required data.Verify that the data is of the correct type, and meets the correct criteria. For example, if a username is submitted it must be validated to contain only permitted characters. Although there is nothing terribly complex about the above process, it usually requires a significant amount of code, and to display error messages, various control structures are usually placed within the form HTML. The Form myform.php. Wikipédia : CodeIgniter. CodeIgniter, le framework au service des Zéros.