Codeigniter framework

933 views
816 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
933
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
28
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Codeigniter framework

  1. 1. 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
  2. 2. CODEIGNITER FRAMEWORKMohammed Shafrinshafrin1125@gmail.comwww.facebook.com/shafrin1125twitter.com/usernamein.linkedin.com/in/shafrin+919961654585
  3. 3. 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.
  4. 4. 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.
  5. 5. 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.
  6. 6. 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.
  7. 7. 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
  8. 8. APPLICATION FLOW CHART
  9. 9. 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.
  10. 10. 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.
  11. 11. 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
  12. 12. 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
  13. 13. 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
  14. 14. 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
  15. 15. 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’);
  16. 16. 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
  17. 17. 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
  18. 18. MODEL• The Model represents yourdata structures.• Typically your model classeswill contain functions thathelp you retrieve, insert, andupdate information in yourdatabase.
  19. 19. 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
  20. 20. Contact Us

×