Welcometo Codeigniter  TutorialAs we all know Codeigniter is a PHP Application Developmentbased framework, a toolkit- for building websites using PHP.  It is a simple, elegant  and powerful toolkit with a very small footprint, used by those developers who wantto create full-featured Web Applications. With the help of this tutorial, youwill be able to develop your project faster as Codeigniter  Framework provides a rich set of libraries forcommonly needed tasks,  also a logicalstructure and simple interface to access these libraries.

It simply minimizesthe amount of code needed  for a giventask while working on  your project.This codeigniter tutorial will cover every thing fromscratch, orderly and systematically, to enable you operate it fully. Topics asmentioned:  Codeigniter versions,Codeigniter Architect, File system, Models, view, URL, database configuration,controller, view record, save record, delete record, authentication example,crud example etc.Audience:This tutorial is useful for developers who want to developwebsites with creativity and ease using codeigniter framework, as well as forthe beginners who want to understand the same from scratch.  Prerequisite:We suggest you that, for acquiring complete benefits of thistutorial, you should already have knowledge of core PHP, HTML,  and Advance PHP.For this tutorial, codeigniter  versionof 3.0.

1 have been used for all the examples. Incase you want to brush upon  core PHP, HTML,  and Advance PHP, or any of it, you can see mytutorials on the same using the following links. For Queries and Problems:Even though we hope that you don’t find any problem duringthe tutorial, still incase you encounter any problem kindly post it in thecontact form, we will personally assist you on the same.

 Advantagesof Using Codeigniter :As there are various sources through which websites can bedeveloped, but Codeigniter is preferred over the others. S ome of the mostimportant advantages are mentioned below.Ø Codeigniter is very simple to configure, as itis an open source framework.Ø As per our own requirement we can docustomization very easily.

Ø Those who don’t want to waste a lot of time indifficult coding, as coding in PHP is easy to use, simple and very quick.Ø It allows us to well organize the codeunderlying our webpage easily.Ø The folder structure used here is lineartherefore very easy to useØ It helps in easy hassle- free migration ofserver hosting from one to another.Ø CodeIgniter make use of the MVC system tosimplify the coding, expedient and reusable.Ø It helps to find out the errors in codes and fixthe issues in the web applications.

Ø It is a user-friendly which help developers tocreate a dynamic, secure and effective web applications in a short time.Ø Programmers can create web applications  aswith additional features and high-end functionalities by using in-builtresource and libraries of the CodeIgniter. Ø Programmers uses CI because of Fast development, It creates both front-end and rear-end of a web-application in secure andfast manner.Ø Its active record implementation feature isoutstanding and quick and easy to remember. CodeigniterInstallation ProcessCodeigniter installation is a very easy process. For theinstallation please follow the given below steps:Ø Step 1: Click at the link to download the Codingniter:  https://www.codeigniter.

com/download§ Codeigniter comes in three flavors: CodeIgniter3 (Current), CodeIgniter 4 (Future) and CodeIgniter 2 (Legacy). For moredetails follow the link mentioned above.§ We can also get all the latest scripts withGitHub.Ø Step 2: Unzip the folderØ Step 3: Upload all the files and folders to your server.Ø Step 4: After following step 3, visit the URL of your server, e.g.

www.domain –name.com       On visiting theURL you will see the given below type of screen.

————————————-ScreenShot————————————————————————————– Codeigniter  Application Flowchart:The working of Codeigniter Application is mentioned in asimple flowchart given below, which will help you understand the entire processeffortlessly in easy steps.  Each andevery step in the flow chart is explained in elaboration and point wise foryour easy grasping.……………………………FLOWCHART……………………………………………………………………………………………………………….§ As shown in the Flow chart, whenever a requestcomes to CodeIgniter, it will first go to index.php page.

§ In the second step, Routing decideswhether to pass the request to step 3 for Caching or to pass the requestto step 4 for Security check.§ If the requested page is already in Caching,then Routing will sanction the request to step 3 and the response will go back to the user.§ In case the request page does not exist in the Caching,then Routing, will sanction the requested page to step 4 for Securitychecks.

§ Before passing the request to ApplicationController, the Security of the submitted data is checked. After theSecurity check is done, the Application Controller loads all thenecessary Models, Libraries, Helpers, Plugins and Scriptsand pass it onto View.§ The View will provide the page withavailable data and pass that on for Caching, to process this pagequickly for future requests. DirectoryStructure:The Directory structure of the Codeigniter is given below inthe Screenshot Image:————————Screenshot of DirectoryStructure———————————————————————- Further to this the Directory Structure of CodeIgniter isdivided into three folders:o   Applicationo   Systemo   User_GuideApplication:As indicated in the name the Application folder contains allthe code of your application that you are building.

This folder is the actualplace where we develop  the project.Within this application folder there exist several other folders as explained below:o  Cache- The Cache folder contains all the cached pages of your application.These cached pages would increase the overall speed of accessing the pages.o  Config- The Config  folder contains various files to configurethe application. With the help of config.php file, you can configure theapplication. Using database.php file, you can configure the database ofyour application.

o  Controllers – This folder contains thecontrollers of your application. It is the basic part of your application.o  Core – This folder contains the base class of your application.o  Helpers – The helper class of yourapplication can be put in this folder.o  Hooks – With the help of files in thisfolder you can tap into and modify the inner workings of the framework  without hacking the core files.o  Libraries – This folder contains thefiles of the library developed for your application.o  Logs – This folder contains the filesrelated to the log of the system.o  Language –This folder contains languagerelated files.

o  Models – The database login is placed inthis file.o  Third_Party – The plugins can be placedin this folder for using it in your application.o  Views – The HTML files of yourapplication can be placed here. System:The System folder contains the CodeIgniter core codes,libraries, helpers and other files, which helps make the coding easy. Thelibraries and helpers are loaded and used for web application development. Thisfolder contains all the CodeIgniter  codeof consequence again organized into various folders mentioned as below:§  Core– The Cache folder contains CodeIgniter core class. Nothing shouldbe modified here. Since all your work will take place in the applicationfolder, if you intend you extend the CodeIgniter core you will have to do itwith hooks, which itself exist in the application folder.

§  Database– This folder contains the database drivers and database utilities.§  Fonts– This folder contains the font related information and the utilities.§  Helpers– The standard CodeIgniter helpers such as data, cookie, and URL helpers exist in this folder.§  Language–Contains language related files. This can be ignored for now.§  Libraries– The folder contains standard CodeIgniter libraries such as e-mail,calendars, file uploads etc.

 You cancreate your own libraries, extend and even replace standard ones. But thosewill be saved in the application/ libraries directory to keep them separatefrom the standard CodeIgniter libraries in this particular folder. User_Guide:It is the offline version of user guide of CodeIgniterWebsite. In other words user guide to CodeIgniter. Using this the variousfunctions of libraries, classes and helpers can be learnt.

It is highlyrecommended that you go through this user guide before building your first webapp using CodeIgniter. Apart from these three folders ( Application, System andUser_Guide ) there is one more important file named ” index.php” . In this fileyou can set the application environment and error level and you can definesystem and application folder name. We highly recommend you not to edit thesesettings  if you do not have enoughknowledge of what you are going to do.

 MVCFramework- Codeigniter…………………………………….MVC MODEL Screenshot……………………………………………………………………………….Codeigniteris PHP Framework which is built on the top of the MVC (Model-View-Controller)development pattern. Model-View-Controller is a software approach whichseparates application logic from presentation. Since the presentation is separate from the PHP scripting here, itpermits the web pages to contain minimal scripting.

Model-The Model consists of the data structures. In a way These typically containsthe sets of the functions that helps in retrieving, inserting and updatinginformation in the database. View-The view is the information that is being presented to the user. A view innormal case is a webpage, but in case of Codeigniter, it can be a page fragmentlike header or footer, or it can be any other type of page like RSS as well asfor performing UI.Controller-The controller implements the logical implementation for writing the programmeand creating the webpage. The controller serves as an intermediary between themodel and the view  and any otherresources  needed to process HTTP requestand generate a webpage. CodeIgniter– Basic Concepts:Models:Models are the classes designed to work with information inthe database.

For example, if we are using CodeIgniter to manage users in ourapplication and we must have model class, which contains functions to insert,delete, update and retrieve our users data.Creating Model Class:As we have already discussed that model classes are storedin the application models directory. Please follow the below given example tounderstand how to create model class in CodeIgniter.———————————————Example ofcreaing models class- Screen Shot———————————In the given above example the Model_ Name is the name ofthe model class that we want to give. Each of the model class must inherit theCodeIgniter’s CI Model class. We must make sure that the first letter of themodel class should always be in the capital letter from.  The class name and the file name shouldalways be same See below the code for the users model class.——————————————-code for usersmodel class snapshot————————————————How to Load the Model:The following code is used to load any model.

Also model canbe called in controller.$this->model(‘model_name’);Where: model_name is the name of the model to be loaded.After loading the model we can simply call its method as given below $this->model_name->method(); How to Auto-Load Models:Theremight situations when we want to use the same model class throughout ourapplication, in that case we use autoload.

—————————-Screenshotfor Autoload load Model————————————————————–Asshown in the above figure, we need to pass the name of the model in the arraythat we want to autoload and it will be autoloaded while the system is in theinitialization state and is accessible throughout the application.     


I'm Erica!

Would you like to get a custom essay? How about receiving a customized one?

Check it out