What is CodeIgniter, and how does it work?

Posted by at 2 February, at 20 : 42 PM Print

What is CodeIgniter?

CodeIgniter is a free, open-source, easy-to-use, object-oriented PHP web application framework, providing a ready-to-use library to use with your own PHP applications. For example, there is a Database API to make it easier and more convenient to execute SQL queries, such as SELECT, UPDATE, DELETE, INSERT, etc., without having to create a lot of repetitive code yourself. This is how an application framework is useful in application development.

CodeIgniter is object-oriented

Using CodeIgniter requiring knowledge of using the object-oriented programming technique in order to be able to use CodeIgniter effectively, and to understand what happens when you are using certain features in CodeIgniter.

But, what is object-oriented programming?

It’s quite difficult to explain object-oriented programming because from a conceptual point of view, it is difficult to understand. However, the main purpose of object-oriented programming is to make application development easier, especially as applications become bigger, with large structures. Object-oriented programming allows application code and logic to be easier to understand, structured and coherently in place, making it easier to develop and extend your application’s features and functionality. With procedural programming (which is merely standard code executed line-by-line with the use of functions as a container for code that help prevent repetitiveness and “reinventing the wheel”), applications can become a mess if they aren’t developed in a way where everything is well laid out, coherent and structured, and can be more difficult to extend and add new features and functionality to your applications later on. With object-oriented programming, in a way, you are forced to be coherent and have your code structured correctly.

Classes and Methods

What are classes and methods? These are the first concepts you’ll be introduced to if you are learning object-oriented programming from most books or online resources. Say you’re creating a framework. You’ll have different classes for different parts of your framework. One being a “Database Class”, one being an “E-mail Class”, and so forth. Of course, in this case, the Database Class is like the CodeIgniter Database Class, providing a set of ready-made methods for you to use so you don’t have to create them yourself in order to execute certain application logic, such as inserting, updating and removing database records quickly, without having to “reinvent the wheel”.

The methods are what contain the application logic, and the class merely holds many related methods together. And this is exactly how your applications would work with the use of the object-oriented programming techniques.

How does CodeIgniter work?

CodeIgniter has a very extensive user guide, which is much better than documentation on some other frameworks, such as CakePHP (which is another PHP framework).

CodeIgniter has classes and helpers.

Classes

Classes contain a collection of methods and properties (properties are essentially variables in an object-oriented context).

For example, here is an example using the Database library within CodeIgniter:

$this->db->get(‘users’,$data);

In any application you make using CodeIgniter, your own classes inherit (or extends) the CodeIgniter class, and so this is why the $this variable is used, which refers to the current class/object. So to call another method within your class, you would use $this->method_name().

Helpers

Helpers contain ordinary PHP functions. Such as the Form Helper.

Other interesting features of CodeIgniter

While this is by no means unique to CodeIgniter, and other web application frameworks use this approach to application development, CodeIgniter primarily uses the Model, View, Controller (MVC) approach to application design and development. It essentially separates application logic from the application design/view. The application logic is the Controller, whereas the application design/view is the View. The Model is for database interactions. There are more complex scenarios where the MVC approach is used, but for basic to intermediate CodeIgniter applications, the Model would contain database interactivity logic of sorts.

Active Record

When you saw an example of using the Database Class above, that code is actually part of the Active Record Class that is part of the Database library.

Active Record is where your work can be shortened by providing an easy and convenient way to execute certain SQL queries without having to write out the entire SQL query yourself. Active Record essentially allows information to be updated, retrieved, added and removed conveniently.

More information on CodeIgniter

The CodeIgniter framework works on all of our shared and reseller servers, and can be installed on pretty much any server with PHP installed. As of writing, CodeIgniter requires PHP version 5.1.6 or higher and obviously a database will be required for any database-driven PHP application (as of writing, MySQL 4.1 or higher). CodeIgniter also supports PostgreSQL, Oracle, SQLite and ODBC. For up to date server requirements, see the CodeIgniter user guide.

Visit the CodeIgniter website

Be Sociable, Share!

Ben Stones

Ben's main IT experience is on software, programming, website development and marketing topics including search engine optimisation. At eUKhost, he regularly works alongside the marketing department on product marketing strategies, and in the development and quality control of the communications which are sent to customers and through the press distribution network. Aside from his regular collaboration with the marketing department on product marketing objectives, Ben occasionally works with the design department in conjunction with the management team on the development of new product pages and the stringent quality control requirements.

Comments

comments

Industry News Web Hosting , , , ,

Related Posts

18 Comments

  1. Weeds Season 8 DVD BoxSetchuck dvd or calling other people you know | Marijuana for MRSA, 1 year ago

    […] True Blood DVD-grey’s anatomy dvd as a crotchety […]

  2. http://wwwvanessabrunosacrcom/Sac vanessa bruno à côté du photographe | Marijuana for MRSA, 1 year ago

    […] vanessa bruno-Sac vanessa bruno à l’intérieur de la même […]

  3. driver taylor made r11golf equipment fighting is often a small section of | Paleciak.com, 1 year ago

    […] adapter, for our electronics. There were one out of your home we had arrived staying,r1 taylormade,cheap beats by dre-beats by dre found on the-spun1 f4, so we also grabbed one in the food market for the island (while it might have been cheaper to buy […]

  4. american horror story season 1 dvdcsi miami dvd here’s the synopsis for th | Marijuana for MRSA, 1 year ago

    […] american horror story season 1 dvd-csi miami dvd i so glad t […]

  5. cheap dvdscsi miami dvd all i need for christmas is my hdtvspun1dj | Marijuana for MRSA, 1 year ago

    […] the little mermaid dvd-csi miami dvd ‘ says a canceled georg […]

  6. wholesale golfwhlesale golf clubs navigating the institution volleyball re | Marijuana for MRSA, 1 year ago

    […] wholesale golf clubs-whlesale golf clubs ron penner describe […]

  7. cheap ralph laurencatcher Real Estate Amazing Homesspun1 o9 | Writings of the Internet, 1 year ago

    […] The land was originally held by tourism entrepreneur and S8 founder Chris Scott through his now defunct company Ridgebell Pty Ltd,beats by dre solo cheapest-I was in tear’say-spun1 u1,http://www.ausralphlaurenshirts.org/. […]

  8. ralph lauren femme pas cherA buzz about the Innspun2 v0 | What do you have to say, 1 year ago

    […] some nit picking comments I’ve heard,http://www.rlshirtsfrance.com/-Big And Tall Men’s Clothing-s,polo ralph lauren pas cher, in my opinion this operation is pitch […]

  9. ping raptureirons golf that can assist you following roundspun1 2j | Marijuana for MRSA, 1 year ago

    […] ping k15 driver-ping golf a whole lot-spun1 6z […]

  10. razr callawaygolf bags meaning the episode ends there | Marijuana for MRSA, 1 year ago

    […] diablo edge callaway-golf balls also state run […]

  11. taylor made uknike boots finally released to proselytize yet again in 1993 | Marijuana for MRSA, 1 year ago

    […] titleist 910 d2 driver-golf bags world golf championships li […]

  12. eiof outlets of louis vuitton oyfq, 1 year ago

    […] […]

  13. cheapest beats dremonster earphones go operating l3 | acupuncture and more, 1 year ago

    […] fact that a home-porn video she generated for her ex has hit digital super-highway. For Bull,cheap beats dre studio-monster earphones that i’m undecided, this is the cue that Sam could possibly be ‘easy’. To Rob,cheap beats-monster […]

  14. g20 試打 golf equipment donation is going to be utilized to provide shelter | Article Servant, 1 year ago

    […] what ball you end up picking. I spent employment rising Force traveling and living worldwide,r11 テーラーメイド pingのゴルフceluiデh​​eglig-spun2 1h. I became raised in Hot Springs, Arkansas in addition to get back to AR. Because i was stationed in […]

  15. taylormade r11s golf one example isspun2spun2spun2 | Marijuana for MRSA, 1 year ago

    […] r11 driver – golf irons this youngster is actually a nationa […]

  16. sun glasses mensralph lauren jackets divided with the ending price of | Marijuana for MRSA, 1 year ago

    […] polo ralph lauren shirts-ralph lauren polo chairman of black […]


Post Your Comment

You must be logged in to post a comment.