• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Codeigniter framework




Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Codeigniter framework Codeigniter framework Presentation Transcript

    • Disclaimer: This presentation is prepared by trainees ofbaabtra as a part of mentoring program. This is not officialdocument of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .Ltd
    • CODEIGNITER FRAMEWORKMohammed Shafrinshafrin1125@gmail.comwww.facebook.com/shafrin1125twitter.com/usernamein.linkedin.com/in/shafrin+919961654585
    • MOTIVATION• PHP, for small sites this works very well. HTML filescan be easily extended with dynamic content from thedatabase, form processing, etc.• When sites grow, you might have realized that acrossmultiple pages lots of code repetition occurs. This is aproblem when you need to change certain parts of apage, that affects many or all pages.• Furthermore, its hard to introduce new developers tocode someone else has written. It takes a long time toget familiar with the code.
    • MOTIVATION…• Enterprise class (big) web applications need structure,one HTML file per page with PHP code is notoptimal => things get confusing, hard to work inteams, etc.• Web Application Frameworks provide such astructure which introduce separation of concern, etc.• Most common for Web application development areframeworks that are based on the Model-View-Controller design pattern.
    • MODEL – VIEW – CONTROLLER (MVC)• “Separation of concerns” of Logic and Presentation.• Controller: Handles all incoming HTTP requests,passes data to the views.• Models: Encapsulate Business Logic, such asinteraction with the database.• For PHP we introduce CodeIgniter.
    • CODEIGNITER• CodeIgniter is a PHP-based MVC framework thathelps structure your code and make redundant tasksless tedious.• There are countless similar PHP frameworks, themost popular ones being CakePHP and symfony.Ruby on Rails is famous in the Ruby world.• CodeIgniter is very light weight. It doesn„t force anyconvention but provides• many commonly required features through a set ofbuild in libraries.
    • CODEIGNITER - FEATURES• Model-View-Controller Based System• Extremely Light Weight, does not force anyconvention• Full Featured database classes with support forseveral platforms• Custom Routing• Form and Data Validation• Security
    • APPLICATION FLOW CHART…1. The index.php serves as the front controller,initializing the base resources needed to runCodeIgniter.2. The Router examines the HTTP request todetermine what should be done with it.3. If a cache file exists, it is sent directly to thebrowser, bypassing the normal system execution.
    • APPLICATION FLOW CHART…4. Security, Before the application controller is loaded,the HTTP request and any user submitted data isfiltered for security.5. The Controller loads the model, core libraries,plugins, helpers, and any other resources needed toprocess the specific request.6. The finalized View is rendered then sent to the webbrowser to be seen. If caching is enabled, the view iscached first so that on subsequent requests it can beserved.
    • GETTING STARTED• Directory Structure of CodeIgniter:• Index.php - recieves all requestsand routes to the right controllersclasses and actions, parameters areincluded in the URL.• /system - contains all CodeIgniterclasses and libraries provided bythe framework• /application - this is where yourapplication code is located,including the model, view andcontroller classes
    • CONTROLLERS• Take incoming HTTP requestsand process them• Must be the same filename as thecapitalized class name• Must extend the main Controllerclass of CodeIgniter• Each class function represents ancontroller action, which isrendering a HTML page• “index” is the default action
    • ROUTING REQUESTS• Per default CodeIgniter maps URL tocontroller actions:/index.php/controller/action• The default controller is “welcome”and the default action is “index”.• Custom routing can be configuredthrough:/application/config/routes.php
    • VIEWS• Are HTML pages or page fragments• Those are load and sent by theController to the Browser by the useof the following code in den Ctrl:$this->load->view(‘blog_view‘);• There is no application logic in theviews, only display logic (to somedegree)• <?= is short form for <?php echo
    • HELPERS• Helper functions are located in/application/helpers/• These are small PHP functions thatprovide shortcuts, to outsource oftenused code• For example formatting, text, url orform helpers• Needs to be loaded through:$this->load->helper(‘name’);
    • LIBRARIES• Libraries are similar to helpers• The also need to be loaded through:$this->load->library(classname);• The difference is that theyencapsulate more complexfunctionality, such as imageprocessing, form validation handling,caching, etc.• Libraries allow to dynamically extendCodeIgniters functionality andextendability
    • DATABASE HANDLING• CodeIgniter provides a simple way toaccess the database.• It encapsulates the underlyingdatabase (MySQL, Oracle, etc)• The connection handling is done byCodeIgniter and configured through:/application/config/database.php• Provides security through automaticescaping of inserted data, avoidsCross-Side Scripting (CSS) attacks
    • MODEL• The Model represents yourdata structures.• Typically your model classeswill contain functions thathelp you retrieve, insert, andupdate information in yourdatabase.
    • If this presentation helped you, please visit ourpage facebook.com/baabtra and like it.Thanks in advance.www.baabtra.com | www.massbaab.com |www.baabte.com
    • Contact Us