SlideShare una empresa de Scribd logo
1 de 29
Introduction to




                  20 May 2009
   Open Source PHP Framework




                                <?php
                                  $this->load->view(‘about’);
   Open Source PHP Framework
   Free (as in beer / as in rights)




                                       <?php
                                         $this->load->view(‘about’);
   Open Source PHP Framework
   Free (as in beer / as in rights)
   The “guts” of ExpressionEngine 2




                                <?php
                                  $this->load->view(‘about’);
   Open Source PHP Framework
   Free (as in beer / as in rights)
   The “guts” of ExpressionEngine 2
   Backed by bootstrapped company




                                <?php
                                  $this->load->view(‘about’);
   ‘01: Rick Ellis develops pMachine




                        <?php
                          $this->load->model(‘event’);
                          $data[‘events’] = $this->event->get_all();
                          $this->load->view(‘history’, $data);
   ‘01: Rick Ellis develops pMachine
   ‘02: pMachine publicly released




                        <?php
                          $this->load->model(‘event’);
                          $data[‘events’] = $this->event->get_all();
                          $this->load->view(‘history’, $data);
   ‘01: Rick Ellis develops pMachine
   ‘02: pMachine publicly released
   ‘04: ExpressionEngine released




                        <?php
                          $this->load->model(‘event’);
                          $data[‘events’] = $this->event->get_all();
                          $this->load->view(‘history’, $data);
   ‘01: Rick Ellis develops pMachine
   ‘02: pMachine publicly released
   ‘04: ExpressionEngine released
   ‘06: CodeIgniter released




                        <?php
                          $this->load->model(‘event’);
                          $data[‘events’] = $this->event->get_all();
                          $this->load->view(‘history’, $data);
   ‘01: Rick Ellis develops pMachine
   ‘02: pMachine publicly released
   ‘04: ExpressionEngine released
   ‘06: CodeIgniter released
   ’08: ExpressionEngine 2 demoed at SXSW



                      <?php
                        $this->load->model(‘event’);
                        $data[‘events’] = $this->event->get_all();
                        $this->load->view(‘history’, $data);
   Small footprint                                           10.5x



                                                              2.9x




                      <?php
                        $this->load->model(‘feature’);
                        $data[‘features’] = $this->feature->get_all();
                        $this->load->view(‘features’, $data);
   Small footprint
   PHP 4 compatible




                       <?php
                         $this->load->model(‘feature’);
                         $data[‘features’] = $this->feature->get_all();
                         $this->load->view(‘features’, $data);
   Small footprint
   PHP 4 compatible
   Database abstraction layer




                      <?php
                        $this->load->model(‘feature’);
                        $data[‘features’] = $this->feature->get_all();
                        $this->load->view(‘features’, $data);
   Small footprint
   PHP 4 compatible
   Database abstraction layer
   Global XSS filtering




                      <?php
                        $this->load->model(‘feature’);
                        $data[‘features’] = $this->feature->get_all();
                        $this->load->view(‘features’, $data);
   Small footprint
   PHP 4 compatible
   Database abstraction layer
   Global XSS filtering
   SEO friendly URLs
        example.com/controller/method/var1/var2




                           <?php
                             $this->load->model(‘feature’);
                             $data[‘features’] = $this->feature->get_all();
                             $this->load->view(‘features’, $data);
   Small footprint
   PHP 4 compatible
   Database abstraction layer
   Global XSS filtering
   SEO friendly URLs
   Infinitely extensible


                      <?php
                        $this->load->model(‘feature’);
                        $data[‘features’] = $this->feature->get_all();
                        $this->load->view(‘features’, $data);
Rasmus Lerdorf
Creator of PHP
Infrastructure Architect, Yahoo
<?php
class Post extends Model {
  function Post() {
    parent::Model();
  }

    function get_all() {
      $this->db->order_by(‘postdate’, ‘DESC’);
      $query = $this->db->get(‘posts’, 10, 0);
      if ($query->num_rows() > 0) {
        return $query->result();
      }
      return FALSE;
    }
}
<?php
class Post extends Model {
  function Post() {
    parent::Model();
  }

    function get_all() {
      $this->db->order_by(‘postdate’, ‘DESC’);
      $query = $this->db->get(‘posts’, 10, 0);
      if ($query->num_rows() > 0) {
        return $query->result();
      }
      return FALSE;
    }
}
<?php
class Post extends Model {
  function Post() {
    parent::Model();
  }

 function get_all() {
    $this->db->order_by(‘postdate’, ‘DESC’);
    $query = $this->db->get(‘posts’, 10, 0);
    if ($query->num_rows() > 0) {
      return $query->result();
    }
    return FALSE;
  }
}
<?php
class Posts extends Controller {
  function Posts() {
    parent::Controller();
  }

    function index() {
      $this->load->model(‘post’);
      $data[‘posts’] = $this->post->get_all();
      $this->load->view(‘home’, $data);
    }
}
<?php
class Posts extends Controller {
  function Posts() {
    parent::Controller();
  }

    function index() {
      $this->load->model(‘post’);
      $data[‘posts’] = $this->post->get_all();
      $this->load->view(‘home’, $data);
    }
}
<?php
class Posts extends Controller {
  function Posts() {
    parent::Controller();
  }

    function index() {
      $this->load->model(‘post’);
      $data[‘posts’] = $this->post->get_all();
      $this->load->view(‘home’, $data);
    }
}
<!-– html, head, body tag -->
<?php foreach($posts as $p): ?>
  <div class=‚post‛>
    <h2><?php echo $p->title; ?></h2>
    <div class=‚excerpt‛>
      <?php echo $p->excerpt; ?>
    </div>
    <p><?php echo anchor($p->id, ‘Read More’); ?></p>
  </div>
<?php endforeach; ?>
<!-- /body, /head, /html tags -->
<!-– html, head, body tag -->
<?php foreach($posts as $p): ?>
  <div class=‚post‛>
    <h2><?php echo $p->title; ?></h2>
    <div class=‚excerpt‛>
      <?php echo $p->excerpt; ?>
    </div>
    <p><?php echo anchor($p->id, ‘Read More’); ?></p>
  </div>
<?php endforeach; ?>
<!-- /body, /head, /html tags -->
<!-– html, head, body tag -->
<?php foreach($posts as $p): ?>
  <div class=‚post‛>
    <h2><?php echo $p->title; ?></h2>
    <div class=‚excerpt‛>
      <?php echo $p->excerpt; ?>
    </div>
    <p><?php echo anchor($p->id, ‘Read More’); ?></p>
  </div>
<?php endforeach; ?>
<!-- /body, /head, /html tags -->
<!-– html, head, body tag -->
<?php foreach($posts as $p): ?>
  <div class=‚post‛>
    <h2><?php echo $p->title; ?></h2>
    <div class=‚excerpt‛>
      <?php echo $p->excerpt; ?>
    </div>
    <p><?php echo anchor($p->id, ‘Read More’); ?></p>
  </div>
<?php endforeach; ?>
<!-- /body, /head, /html tags -->
<!-– html, head, body tag -->
<?php foreach($posts as $p): ?>
  <div class=‚post‛>
    <h2><?php echo $p->title; ?></h2>
    <div class=‚excerpt‛>
      <?php echo $p->excerpt; ?>
    </div>
    <p><?php echo anchor($p->slug, ‘Read More’); ?></p>
  </div>
<?php endforeach; ?>
<!-- /body, /head, /html tags -->




   example.com/refreshaugust-may-2009
michaelwales.com
    Twitter: @walesmd
webmaster@michaelwales.com

Más contenido relacionado

La actualidad más candente

PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overview
jsmith92
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kian
phelios
 
Real World Dependency Injection - oscon13
Real World Dependency Injection - oscon13Real World Dependency Injection - oscon13
Real World Dependency Injection - oscon13
Stephan Hochdörfer
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
Stephan Hochdörfer
 

La actualidad más candente (20)

Redis for your boss
Redis for your bossRedis for your boss
Redis for your boss
 
Clear php reference
Clear php referenceClear php reference
Clear php reference
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overview
 
Perl6 grammars
Perl6 grammarsPerl6 grammars
Perl6 grammars
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kian
 
Real World Dependency Injection - oscon13
Real World Dependency Injection - oscon13Real World Dependency Injection - oscon13
Real World Dependency Injection - oscon13
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
 
Functional Structures in PHP
Functional Structures in PHPFunctional Structures in PHP
Functional Structures in PHP
 
New in php 7
New in php 7New in php 7
New in php 7
 
TDC2016SP - Trilha Developing for Business
TDC2016SP - Trilha Developing for BusinessTDC2016SP - Trilha Developing for Business
TDC2016SP - Trilha Developing for Business
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014Hardcore URL Routing for WordPress - WordCamp Atlanta 2014
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014
 
Developing for Business
Developing for BusinessDeveloping for Business
Developing for Business
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
 
Semantic Web & TYPO3
Semantic Web & TYPO3Semantic Web & TYPO3
Semantic Web & TYPO3
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using Codeception
 
Testing TYPO3 Applications
Testing TYPO3 ApplicationsTesting TYPO3 Applications
Testing TYPO3 Applications
 
Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLID
 
Symfony without the framework
Symfony without the frameworkSymfony without the framework
Symfony without the framework
 

Destacado

PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
Ford AntiTrust
 

Destacado (9)

How To Build A Website And Stay Sane
How To Build A Website And Stay SaneHow To Build A Website And Stay Sane
How To Build A Website And Stay Sane
 
Scaling a Web Site - OSCON Tutorial
Scaling a Web Site - OSCON TutorialScaling a Web Site - OSCON Tutorial
Scaling a Web Site - OSCON Tutorial
 
Y!7 Simple Scalability
Y!7 Simple ScalabilityY!7 Simple Scalability
Y!7 Simple Scalability
 
Large Scale PHP
Large Scale PHPLarge Scale PHP
Large Scale PHP
 
Scaling LAMP doesn't have to suck
Scaling LAMP doesn't have to suckScaling LAMP doesn't have to suck
Scaling LAMP doesn't have to suck
 
Memcached vs redis
Memcached vs redisMemcached vs redis
Memcached vs redis
 
Php 7 hhvm and co
Php 7 hhvm and coPhp 7 hhvm and co
Php 7 hhvm and co
 
Large-scale projects development (scaling LAMP)
Large-scale projects development (scaling LAMP)Large-scale projects development (scaling LAMP)
Large-scale projects development (scaling LAMP)
 
PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
 

Similar a Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)

PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 
Cakefest 2010: API Development
Cakefest 2010: API DevelopmentCakefest 2010: API Development
Cakefest 2010: API Development
Andrew Curioso
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в Magento
Magecom Ukraine
 
Testing persistence in PHP with DbUnit
Testing persistence in PHP with DbUnitTesting persistence in PHP with DbUnit
Testing persistence in PHP with DbUnit
Peter Wilcsinszky
 

Similar a Introduction to CodeIgniter (RefreshAugusta, 20 May 2009) (20)

Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Secure Coding With Wordpress (BarCamp Orlando 2009)
Secure Coding With Wordpress (BarCamp Orlando 2009)Secure Coding With Wordpress (BarCamp Orlando 2009)
Secure Coding With Wordpress (BarCamp Orlando 2009)
 
Cakefest 2010: API Development
Cakefest 2010: API DevelopmentCakefest 2010: API Development
Cakefest 2010: API Development
 
Curso Symfony - Clase 4
Curso Symfony - Clase 4Curso Symfony - Clase 4
Curso Symfony - Clase 4
 
Framework
FrameworkFramework
Framework
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в Magento
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 
Os Nixon
Os NixonOs Nixon
Os Nixon
 
State Machines to State of the Art
State Machines to State of the ArtState Machines to State of the Art
State Machines to State of the Art
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To Lamp
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
PHP
PHP PHP
PHP
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
Advanced PHPUnit Testing
Advanced PHPUnit TestingAdvanced PHPUnit Testing
Advanced PHPUnit Testing
 
Testing persistence in PHP with DbUnit
Testing persistence in PHP with DbUnitTesting persistence in PHP with DbUnit
Testing persistence in PHP with DbUnit
 
jQuery Performance Rules
jQuery Performance RulesjQuery Performance Rules
jQuery Performance Rules
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)

  • 1. Introduction to 20 May 2009
  • 2. Open Source PHP Framework <?php $this->load->view(‘about’);
  • 3. Open Source PHP Framework  Free (as in beer / as in rights) <?php $this->load->view(‘about’);
  • 4. Open Source PHP Framework  Free (as in beer / as in rights)  The “guts” of ExpressionEngine 2 <?php $this->load->view(‘about’);
  • 5. Open Source PHP Framework  Free (as in beer / as in rights)  The “guts” of ExpressionEngine 2  Backed by bootstrapped company <?php $this->load->view(‘about’);
  • 6. ‘01: Rick Ellis develops pMachine <?php $this->load->model(‘event’); $data[‘events’] = $this->event->get_all(); $this->load->view(‘history’, $data);
  • 7. ‘01: Rick Ellis develops pMachine  ‘02: pMachine publicly released <?php $this->load->model(‘event’); $data[‘events’] = $this->event->get_all(); $this->load->view(‘history’, $data);
  • 8. ‘01: Rick Ellis develops pMachine  ‘02: pMachine publicly released  ‘04: ExpressionEngine released <?php $this->load->model(‘event’); $data[‘events’] = $this->event->get_all(); $this->load->view(‘history’, $data);
  • 9. ‘01: Rick Ellis develops pMachine  ‘02: pMachine publicly released  ‘04: ExpressionEngine released  ‘06: CodeIgniter released <?php $this->load->model(‘event’); $data[‘events’] = $this->event->get_all(); $this->load->view(‘history’, $data);
  • 10. ‘01: Rick Ellis develops pMachine  ‘02: pMachine publicly released  ‘04: ExpressionEngine released  ‘06: CodeIgniter released  ’08: ExpressionEngine 2 demoed at SXSW <?php $this->load->model(‘event’); $data[‘events’] = $this->event->get_all(); $this->load->view(‘history’, $data);
  • 11. Small footprint 10.5x 2.9x <?php $this->load->model(‘feature’); $data[‘features’] = $this->feature->get_all(); $this->load->view(‘features’, $data);
  • 12. Small footprint  PHP 4 compatible <?php $this->load->model(‘feature’); $data[‘features’] = $this->feature->get_all(); $this->load->view(‘features’, $data);
  • 13. Small footprint  PHP 4 compatible  Database abstraction layer <?php $this->load->model(‘feature’); $data[‘features’] = $this->feature->get_all(); $this->load->view(‘features’, $data);
  • 14. Small footprint  PHP 4 compatible  Database abstraction layer  Global XSS filtering <?php $this->load->model(‘feature’); $data[‘features’] = $this->feature->get_all(); $this->load->view(‘features’, $data);
  • 15. Small footprint  PHP 4 compatible  Database abstraction layer  Global XSS filtering  SEO friendly URLs example.com/controller/method/var1/var2 <?php $this->load->model(‘feature’); $data[‘features’] = $this->feature->get_all(); $this->load->view(‘features’, $data);
  • 16. Small footprint  PHP 4 compatible  Database abstraction layer  Global XSS filtering  SEO friendly URLs  Infinitely extensible <?php $this->load->model(‘feature’); $data[‘features’] = $this->feature->get_all(); $this->load->view(‘features’, $data);
  • 17. Rasmus Lerdorf Creator of PHP Infrastructure Architect, Yahoo
  • 18. <?php class Post extends Model { function Post() { parent::Model(); } function get_all() { $this->db->order_by(‘postdate’, ‘DESC’); $query = $this->db->get(‘posts’, 10, 0); if ($query->num_rows() > 0) { return $query->result(); } return FALSE; } }
  • 19. <?php class Post extends Model { function Post() { parent::Model(); } function get_all() { $this->db->order_by(‘postdate’, ‘DESC’); $query = $this->db->get(‘posts’, 10, 0); if ($query->num_rows() > 0) { return $query->result(); } return FALSE; } }
  • 20. <?php class Post extends Model { function Post() { parent::Model(); } function get_all() { $this->db->order_by(‘postdate’, ‘DESC’); $query = $this->db->get(‘posts’, 10, 0); if ($query->num_rows() > 0) { return $query->result(); } return FALSE; } }
  • 21. <?php class Posts extends Controller { function Posts() { parent::Controller(); } function index() { $this->load->model(‘post’); $data[‘posts’] = $this->post->get_all(); $this->load->view(‘home’, $data); } }
  • 22. <?php class Posts extends Controller { function Posts() { parent::Controller(); } function index() { $this->load->model(‘post’); $data[‘posts’] = $this->post->get_all(); $this->load->view(‘home’, $data); } }
  • 23. <?php class Posts extends Controller { function Posts() { parent::Controller(); } function index() { $this->load->model(‘post’); $data[‘posts’] = $this->post->get_all(); $this->load->view(‘home’, $data); } }
  • 24. <!-– html, head, body tag --> <?php foreach($posts as $p): ?> <div class=‚post‛> <h2><?php echo $p->title; ?></h2> <div class=‚excerpt‛> <?php echo $p->excerpt; ?> </div> <p><?php echo anchor($p->id, ‘Read More’); ?></p> </div> <?php endforeach; ?> <!-- /body, /head, /html tags -->
  • 25. <!-– html, head, body tag --> <?php foreach($posts as $p): ?> <div class=‚post‛> <h2><?php echo $p->title; ?></h2> <div class=‚excerpt‛> <?php echo $p->excerpt; ?> </div> <p><?php echo anchor($p->id, ‘Read More’); ?></p> </div> <?php endforeach; ?> <!-- /body, /head, /html tags -->
  • 26. <!-– html, head, body tag --> <?php foreach($posts as $p): ?> <div class=‚post‛> <h2><?php echo $p->title; ?></h2> <div class=‚excerpt‛> <?php echo $p->excerpt; ?> </div> <p><?php echo anchor($p->id, ‘Read More’); ?></p> </div> <?php endforeach; ?> <!-- /body, /head, /html tags -->
  • 27. <!-– html, head, body tag --> <?php foreach($posts as $p): ?> <div class=‚post‛> <h2><?php echo $p->title; ?></h2> <div class=‚excerpt‛> <?php echo $p->excerpt; ?> </div> <p><?php echo anchor($p->id, ‘Read More’); ?></p> </div> <?php endforeach; ?> <!-- /body, /head, /html tags -->
  • 28. <!-– html, head, body tag --> <?php foreach($posts as $p): ?> <div class=‚post‛> <h2><?php echo $p->title; ?></h2> <div class=‚excerpt‛> <?php echo $p->excerpt; ?> </div> <p><?php echo anchor($p->slug, ‘Read More’); ?></p> </div> <?php endforeach; ?> <!-- /body, /head, /html tags --> example.com/refreshaugust-may-2009
  • 29. michaelwales.com Twitter: @walesmd webmaster@michaelwales.com

Notas del editor

  1. #1 Google result for “open source PHP framework”
  2. Free to downloadCan virtually do anything with framework- Can not create a commercial blogging application
  3. EE2 is built on top of the CodeIgniter framework
  4. EllisLab supports the company and it’s 11 employees off of ExpressionEngine primarily.CodeIgniter is the foundation of the new version of ExpressionEngine.EllisLab is committed to supporting the framework, it’s not a side project it is the core of their business.
  5. In 2001, Rick Ellis started work on a blogging engine for his clients.The first installation of pMachine was for Nancy Sinatra (Frank Sinatra’s daughter).
  6. In 2002, pMachine was released.Featured in Mac World and Mac Addict as well as a Blogging book published by McGraw/Hill.Rick Ellis starts developing software full-time.
  7. ExpressionEngine succeeds pMachine and is a more fully feature complete Content Management System.ExpressionEngine sees great success within the designer market, on their personal blogs (VeerlePieters, for instance).
  8. EllisLab pulls the core code out of ExpressionEngine and refactors into a framework.
  9. At SXSW ’08, EllisLab announces ExpressionEngine 2.Derek Allard, Code Architect for EllisLab, announces that ExpressionEngine 2 will run on top of the CodeIgniter framework.Full Circle: CodeIgniter was born from ExpressionEngine and now it is powering ExpressionEngine
  10. Benchmarking performed by AvnetLabs w/ eAcceleratoropcode caching10.5x faster than CakePHP, 2.9x faster than Zend Framework (similar configurations / similar functionality)I’ve never seen a benchmark where CodeIgniter didn’t outperform all competitors
  11. Statistics dated Oct 08, from nexen.netShows about a 50/50 split between PHP4 and 5 support.No doubt PHP5 has taken the lead by now, but many users still stuck on PHP4.CodeIgniter utilizes PHP5 features/performance-enhancing functionality when present.
  12. MySQL is by far the most supported but could switch without the need to completely rewrite code.Supports MySQL, MS SQL, Oracle, PostgreSQL, SQLite and ODBC connectors.ActiveRecord class allows you to think in PHP and generate SQL.
  13. Facebook, MySpace,Twitter and other social networks have seen the rise of a new form of worm.These worms are Javascript based, essentially the attacker enters code into a form that your site displays somewhere.This allows the malicious code to run from your domain essentially bypassing all of the domain-lock features Javascript has built-in.At the flick of a boolean variable, CodeIgniter will automatically protect all of your form fields from XSS vulnerabilities.
  14. CodeIgniter automatically generates SEO friendly URLsOf course, this is easily overidden: regular expression pattern matching to point to controller/method and pass variables
  15. Nearly every CodeIgniter library and helper can be overridden – allowing you to increase functionality.Examples: auto-discovery of partial views, auto-discovery of models, authentication by basing application classes off of my own controller class, which in turns extends the CodeIgniter Controller class
  16. RasmusLerdorf at fOScon 08.He gave a presentation pretty much slamming all PHP frameworks. If he had to pick one, it would be CodeIgniter.
  17. The model represents our data – in this particular case we are returning data from a database.Could return data from anything – a Web API, an XML file, JSON, etc.
  18. All models extends CodeIgniter’s Model class and must call the parent class’ constructor from their own constructor.
  19. This function starts building our SQL query by creating the ORDER BY portion.get() will run the query against the posts table, returning 10 results starting at row 0.We also have a get_where() method, that allows you to pass WHERE statements.get() will return all columns, but a select() method is available to define columns if necessary.We use the num_rows() method to return a result object or the FALSE boolean.
  20. The controller accepts and handles all user input (URLs, POST/GET requests, etc.)Like the model, a controller extends the CI Controller class.Controllers must call their parent constructor from within their own constructor.index() method is called by default, if a method is not defined in the URL.We load our post model, then call the get_all() method of that model.We then load a view, called home, and pass it our array of variables (in this case, only the posts).
  21. Like the model, a controller extends the CI Controller class.Controllers must call their parent constructor from within their own constructor.
  22. index() method is called by default, if a method is not defined in the URL.We load our post model, then call the get_all() method of that model.We then load a view, called home, and pass it our array of variables (in this case, only the posts).
  23. The view is simply an HTML file with PHP inter-mixed.Logic should be kept to a bare minimum – just echo data in the view.Templating engines can be used and CI even has a Template Parsing class (why would you want to add more processing time)?Notice the lack of the $data variable – within a view, CodeIgniter brings all $data keys (or child objects) up to top-level variables.Normally, we would check for a FALSE value before looping and show a “No Posts” message – lack of space on screen here.
  24. Loop through each of the results returned from our database call (which happened in the model).
  25. Echo out the title of the post, title was one of the fields within our posts table.
  26. Echo out the excerpt of the post, once again a field within our table.
  27. Use a CodeIgniter helper to generate a link to read the entire post.First parameter is the URI segments, second is text of the link, third is an optional array of HTML attributes.Slug was a field within our database – CodeIgniter has a helper to autocreate slugs from text.Would use URI routing to process this request and send it to Controller/Method