PHP + Framework + MVC. What is Framework? Common code - Generic functionality Extensible - Specific functionality Unlike library – Flow Dictated by.

Slides:



Advertisements
Similar presentations
Struts Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Advertisements

Site Collection, Sites and Sub-sites
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
.NET 3.5 SP1 New features Enhancements Visual Studio 2008 SP1 New features Enhancements Additional features/enhancements.
Introduction to ASP.NET MVC
My Very First… Model View Controller Web Application with the Zend Framework New York City ZF Meetup.
JSP1 Java Server Pages (JSP) Introducing JavaServer Pages TM (JSP TM ) JSP scripting elements.
Keys, Referential Integrity and PHP One to Many on the Web.
INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
Ruby on Rails Model of MVC. Model-View-Controller Paradigm A way of organizing a software system Benefits: Isolation of business logic from the user interface.
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
Web Applications Development Using Coldbox Platform Eddie Johnston.
NMD202 Web Scripting Week5. What we will cover today PHPmyAdmin Debugging – using print_r Modifying Data PHP (cont.) 4D Methodology File and IO operations.
Software Freedom Day th September 2007 Asia Pacific Institute of Information Technology Colombo, Sri Lanka. Nazly Ahmed Scripting The Web.
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
User Group 2015 Version 5 Features & Infrastructure Enhancements.
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
Struts 2.0 an Overview ( )
Ruby on Rails. What is Ruby on Rails? Ruby on Rails is an open source full-stack web framework. It is an alternative to PHP/MySQL. It can render templates,
JQuery CS 268. What is jQuery? From their web site:
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Dataface API Essentials Steve Hannah Web Lite Solutions Corp.
Danielle Baldwin, ITS Web Services CMS Administrator Application Overview and Joomla 1.5 RC 1 Highlights.
ZFApp Preview Walkthrough. What is ZFApp? ZFApp is an application framework built on top of Zend Framework Fully compatible with the latest ZF Versions.
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
Training Course 2 User Module Training Course 3 Data Administration Module Session 1 Orientation Session 2 User Interface Session 3 Database Administration.
Server-side Scripting Powering the webs favourite services.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Joomla! Day France SEBLOD Version 2.0 for Joomla! 1.6.
Oracle Application Express 3.0 Joel R. Kallman Software Development Manager.
Codeigniter is an open source web application. It occupies a very small amount of space in the memory and is most useful for developers who aim to develop.
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
MVC & ActiveRecord by Christian Mohr & Mohamed Souiai.
Standalone Java Application vs. Java Web Application
PHP meets MySQL.
School of Computing and Information Systems CS 371 Web Application Programming CakePHP Server-side Framework.
Introduction to Model-Glue Rachel Lehman Perpetual Intermediate Designer-Developer Introduction to Model-Glue.
PHP + Framework + MVC CakePHP Lectures 1. What is Framework? CakePHP Lectures 2.
Yii is “yes it is” from this we can know that surely it would be a highly needed technology for website developers for its high performance. It is suitable.
CakePHP is an open source web development framework. It follows Model-View- Controller and is developed using PHP. IT is the basic for user to create.
CAKEPHP Blog tutorial. what you’ll need examples/blog/blog.html 2  A running web server  A database server.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Arnold Geraldo Designing and Making of The Online Auction Website Using CakePHP Framework.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
FlexElink Winter presentation 26 February 2002 Flexible linking (and formatting) management software Hector Sanchez Universitat Jaume I Ing. Informatica.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
ICM – API Server & Forms Gary Ratcliffe.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
Date : 3/04/2010 Web Technology Solutions Class: PHP Web Application Frameworks.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
CGS 3066: Web Programming and Design Spring 2016 PHP.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
START Application Spencer Johnson Jonathan Barella Cohner Marker.
Top 50 Interview Questions & Answers in CakePHP. 2 Question : 1 What is CakePHP?  CakePHP is a free, open-source, rapid development framework for PHP.
Cake PHP – OOPS approach for PHP
PHP + Framework + MVC. What is Framework? Common code - Generic functionality Extensible - Specific functionality Unlike library – Flow Dictated.
Web Technology Solutions
Jim Fawcett CSE686 – Internet Programming Spring 2014
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
What is Laravel ? By Georgi Genov.
Jim Fawcett CSE686 – Internet Programming Spring 2012
MVC Architecture, Symfony Framework for PHP Web Apps
Data Virtualization Tutorial… CORS and CIS
Play Framework: Introduction
Content Management System
Haritha Dasari Josue Balandrano Coronel -
PHP Training at GoLogica in Bangalore
Design and Maintenance of Web Applications in J2EE
Presentation transcript:

PHP + Framework + MVC

What is Framework?

Common code - Generic functionality Extensible - Specific functionality Unlike library – Flow Dictated by Framework

Reusable Design- May include: Support programs Code libraries Tools to develop and glue different components

Why a Framework?

I am lazy enough to write long codes, NAAAH...

Technical Aspects: Proven Architecture Efficient (Code Re-usability) Scalable Extensible Modularity

Developer Aspects: Easier maintenance Shorter development times. Flexible and less error-prone

Focus => Specialized Functionality NOT Architecture Common Tools Work Flow

How to choose Framework?

Ofcourse, NOT

Technical Aspects: Types of application, Types of framework Technical features of the framework Ease of development Ease of testing Tool support

Viability Aspects: Frequent release Future enhancement Maturity – real life usage cases Proven market place? Production Environments?

So, which one?

The one which answers most of the above questions.

PHP + Framework + MVC CakePHP

Free Open Source Rapid Application Development Active Community Compatibility with PHP4 and PHP5 Project Age - 5yrs

MVC Scaffolding Validation Data Sanitation ACL Components Helpers Security Session Caching

Easy Installation – 2 Mins Easy Debugging Integrated Unit Testing

Setting Up Cake: Setup Database Configuration CakePHP supports database drivers: mysql postgres sqlite pear-drivername (e.g. pear-mysql) adodb-drivername

Models: Access point to a certain table in the database Contain data validation rules, association information, and methods specific to the table Extends AppModel

Models: Table name in plural, like "users" and models in singular user. Mandatory Primary key named 'id'. Foreign keys naming: 'article_id'. (singular-table-name_id). 'created' / 'modified' column are automatically populated.

Controllers: Manage the logic for a certain section or a single model. Include any number of actions Actions are functions used in your web application to display views Extends AppController

class VideosController extends AppController { function view($id) { //action logic goes here.. } function rent($customer_id, $video_id) { //action logic goes here.. } function search($query) { //action logic goes here.. } example URLs:

Controller action as a webservice Set WEBSERVICES in / app/config/core.php to 'on' Structure the logic in controller just as you normally would

Views: a page template, usually named after an action. view for PostsController::add() would be found at /app/views/posts/add.thtml. simply PHP files, so you can use any PHP code inside them

Views: data is passed as an array called $data data handed to the view using set() in the controller is also available in view. HTML helper is available in every view by default layout contains presentational code that wraps around view. Usually, common for one controller.

Scaffolding: Way of getting the early parts of developing a web application started. Analyze database tables and creates standard lists, add, delete, edit. Add scaffolding by adding the $scaffold variable to controller.

Components: Components are used to aid controllers in specific situations. A Reusable code which seamlessly sits inside Controller Sample Component Class class FooComponent extends Object { var $someVar = null; var $controller = true; function startup(&$controller) { // Perform controller initialization here. } function doFoo() { $this->someVar = 'foo'; }

add the following code in your controller's definition: var $components = array('Foo'); Inside of that controller you could now use: $this->Foo->doFoo();

Helpers: Common functions to format views. Quick-and-easy creation of web forms image ( $path, $htmlAttributes, $return = false ); Renders an image tag. tableHeaders ( $names, $tr_options, $th_options ); create a formatted table header.

Other Helpers: AJAX Javascript Number Text Time Cache (You can create your own helper.)

Data Validation: Data in a Model conforms to the business rules. Example /app/models/user.php <?php class User extends AppModel { var $name = 'User'; var $validate = array( 'login' => '/[a-z0-9\_\-]{3,}$/i', 'password' => VALID_NOT_EMPTY, ' ' => VALID_ , 'born' => VALID_NUMBER ); } ?>

Plugins: Distribute combination of controllers, models, and views as package. Example: Pizza Ordering Filesystem Layout /app /plugins /pizza /controllers <- plugin controllers go here /models <- plugin models go here /views <- plugin views go here /pizza_app_controller.php <- plugin's AppController,named after the plugin /pizza_app_model.php <- plugin's AppModel, named after the plugin

ACL: Access Request Objects (AROs) and Access Control Objects (ACOs) $aro = new Aro(); // Create ARO $aro->create( 1, null, 'Bob Marley' ); // Create Groups $aro->create(0, null, 'Artists'); //Hook ARO with Group $aro->setParent('Artists', 'Bob Marley');

Creating ACOs and assigning permissions $aco = new Aco(); //Create some access control objects: $aco->create(1, null, 'Electric Guitar'); $this->Acl->allow('Abraham Lincoln', 'Electric Guitar','read');

// Check Access $access = $this->Acl->check($this->Session-> read('user_alias'), $aco, $action = "*"); //access denied if ($access === false) { echo "access denied"; exit; }

Data Sanitation: Makes User Given Data Safe for use in SQL and HTML // First, include library and instantiate: uses('sanitize'); $mrClean = new Sanitize(); $badString = ";: echo $mrClean->paranoid($badString); // output: scripthtml echo $mrClean->paranoid($badString, array(' ', // output: scripthtml

Sessions: Here are some of the functions you'll use most: check ($name); del ($name); delete ($name); Error (); flash ($key = 'flash'); read ($name); renew (); ;

Security: RequirePost() class ThingsController extends AppController { var $components = array('Security'); function beforeFilter() { $this->Security->requirePost('delete'); } function delete($id) { // This will only happen if the action is called via an HTTP POST request $this->Thing->del($id); }

5 Mins Blog Tutorial with Unit Testing