benefit of codeigniter php framework

Download Benefit of CodeIgniter php framework

Post on 20-Aug-2015

2.664 views

Category:

Technology

1 download

Embed Size (px)

TRANSCRIPT

  • Benefit of CodeIgniter PHP FrameworkAppleboy (Bo-Yi Wu)2010.09.19

  • About Me (Bo-Yi Wu) Software EngineerGemtek- Wireless Broadband Anywhere ()Android Linux Kernel Driver, Switch Router embedded LinuxCodeIgniter CodeIgniter PHP Plurk API (Google Code)

  • Evolution of Web Developmentindex.phpabout.phpnews.phplinks.phpcontact.phpproduct.php..

  • Evolution of Web Developmentindex.phppage.phpheader.phpnews.phpfooter.php header footer

  • Evolution of Web Developmentindex.phpControllerModelView PHP Framework

  • Why use Framework

  • Why use FrameworkA web application frameworkDynamic websitesLibraries for database accessTemplate frameworksSession managementPagination functionOften promote code reuseMany more .

  • MVC ArchitectureWEB SERVERROUTESControllerViewMODELLAYOUTDatabaseClient BROWSER

  • MVCView (views/showProduct.php)Product Count:Controller (controllers/product.php)function showProduct($id) {$this->load->model(product);$count = $this->product->getCount($id);$data[count] = $count;$this->load->view(showProduct, $data);}Model (controllers/product.php)function getCount($id) {$this->db->where(id, $id);$this->db->from(my_product);$query = $this->db->get();return $->num_rows();}ViewControllerModel

  • Public Web Framework

  • Why Choose CodeIgniterSmall ()Fast ( load )Simple ()Customer CI FrameworkCleaner Code ( Framework)

  • What is CodeIgniter????An Open Source Web Application FrameworkNearly Zero ConfigurationMVC (Model View Controller) ArchitectureDB ObjectTemplatingCachingModulesHelperValidation

  • How to install CodeIgniter

  • RequirtmentWindows, FreeBSD, Linux......Apache, lighttpd, NginxPHPPHP 4.3.2 or Higher....DatabaseMySQL, MySQLi, MS SQL, Postgres, SQLite...

  • wget http://codeigniter.com/.......unzip CodeIgniter_1.7.2.zipedit application/config/config.phpapplication/config/database.php

    You can see http://localhost/ci/index.php

  • Application Flow Of CodeIgniter

  • CodeIgniter URLhttp://localhost/news.php?mode=edit&id=10http://localhost/index.php/news/edit/10

  • CodeIgniter Directorysystemuser_guide (English Document)index.php Application , CodeIgniter

  • CodeIgniter System DirectoryApplicationCacheCodeigniterDatabase..............Conroller, Model, Views

  • CodeIgniter Application DirectoryConfig -> Controllers -> ControllerErrors -> CI error messageHelpers -> CI HelpersHooks Language -> Libraries -> Models -> Database Views ->

  • Controllerclass News extends Controller { function __construct() {parent::Controller();}function index(){echo welcome CodeIgniter;}}Should be placed under application/controllers

  • Controllerclass News extends Controller { function __construct() {parent::Controller();}function index(){}function edit($id){echo news id is . $id;}}

    url: http://localhost/news/edit/10

  • ViewsShould be placed under application/views/index.php

    My First CodeIgniter Project

    Welcome to My CodeIgniter

  • ViewsCalling a VIEW from Controller$this->load->view(index);Data Passing to a VIEW from Controllerfunction index() {$data = array(full_name => appleboy,email => appleboy.tw@gmail.com);$this->load->view(index, $data);}

  • Views

    ..::Personal Info::..

    Full Name : E-mail :

  • ModelsModels Should be placed Under application/models/class News_model extends Model { function Mlb_model() {parent::Model(); } function get_news($id) { $this->db->select(news_id, news_name'); $this->db->from('project_news'); $query = $this->db->get(); return $query->result_array(); } }

  • Loading a Model inside a Controller$this->load->model(news_model);$data = $this->news_model->get_news();

  • CodeIgniter LibrariesDatabase ()File Uploading ()Pagination ()Input and Security (SQL Injection)SessionForm Valitation ()

  • How to load Libraries?

  • $this->load->library(class name); $this->load->library(validation);

  • CodeIgniter HelpersUrl helpersite_url()base_url()anchor()mailto()auto_link()Download helperforce_download()

  • How to load helper?

  • $this->load->helper(helper name); $this->load->helper(download);

  • Auto-loading ResourcesCore classes found in the "libraries" folder Helper files found in the "helpers" folder Plugins found in the "plugins" folder Config files found in the "config" folder Language files found in the "language" folder Models found in the "models" folder

  • application/config/autoload.php $autoload['libraries'] = array();$autoload['helper'] = array();$autoload['plugin'] = array();

  • CodeIgniter Online ResourceCodeIgniter Wiki ()(http://goo.gl/RwaC)(http://goo.gl/CfJi)Google CodeIgniter ........

  • Thank You

Recommended

View more >