Beginning Codeigniter Application Development

Prerequisites:

However, prior using codeigntier, its required that you know what mvc design pattern is. To more about mvc, you can start with the wiki article on mvc .

Also, wish you have already xampp/wamp or something similar already set up in your computer. Now, Download the latest version of codeigniter. extract it and copy the directory to the root of your local server. without doing anything else, you should be able to run this and see a page like as follows from this local url: http://localhost/codeigntier/

running-codeigniter-firsttime

Directory Structure:

The application directory structure is mainly consists of 2 directory, ‘system’ and ‘application’.

codeigniter-project-directory

The ‘system’ directory is the core and consists of the core framework files. When a new version is released, you can update your existing application just by replacing this system directory with the latest release. We won’t never going to work on this folder our selves ever. All our codes are going to take place in the ‘application directory’. There you will see a list of sub directories as like the following image:

codeigniter-directory-structure

Lets get a little familiar with the directories:

  • Cache : This directory will contain all kinds of cached files if you are using so. However, you will may need to provide write access for the application to this directory as codeigniter will need to create temporary files on this folder. To know how to use output caching, please refer to web page caching on codeigniter. You can also utilize codeigniter’sCaching Class .
  • Config : This directory includes settings/configuration related information like database settings, route information, constants declaration, items to be auto loaded etc. To know more, please visit codeigniter documentation about using config class .
  • Controller : This directory includes all controller definitions. It can be said as the entry point of application also, every requests triggers a certain method of a controller.
  • Core : If we need to extend the functionality of any core classes like controller,loader,router etc, then we can declare new class here which will extends those core classes and put the implementation inside those.
  • Errors : This directory includes some basic template for showing various kind of errors like db error, php errors, 404 errors etc, which we can modify later as per our requirements.
  • Helpers : This directory will include all helper files. Read more about using helpers.
  • Hooks : This directory will include all hooks declaration. Read more aboutusing hooks
  • Language : This directory will include language files. By loading different language files, we can make our application multilingual supported. Read more about using language class.
  • Libraries : This directory will include all library class files that might need to be created for our applications.
  • Logs : This directory will include all application logs. TO know how to write log for debug/error/info, please more about error handling
  • Migrations : This directory will include migration helpers.
  • Models : This directory will include all model classes used in our application. This section can be said as the ‘data access layer’ of our application.
  • Third_party : This directory will include library files, but only those, which are imported from third party. So, difference between the ‘third_party’ and ‘libraries’ is that, one is for self made libraries, for app specific, other one is for importing party libraries.
  • Views : This directory will include all view template files.

For Video Tutorials:

http://codesamplez.com/development/codeigniter-basic-tutorial

Advertisements