SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
Zend Framework 1.x
$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
whoami

   •   Matteo Magni
   •   @ilbonzo
   •   https://github.com/ilbonzo
   •   http://it.linkedin.com/in/matteomagni



$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Zend Framework 1.X

   • Zend Framework is an open source, object oriented
     web application framework for PHP 5. Zend
     Framework is often called a 'component library',
     because it has many loosely coupled components
     that you can use more or less independently.
   • http://framework.zend.com/
   • BSD license
   • Version 1.11
$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Installation
   • Register and download source
   • Add to your include path
        – sudo mv ~/ZendFramework­1.11.11/library/Zend/ 
          /usr/share/php/Zend
             OR
        – sudo mv ~/ZendFramework­1.11.11/library/Zend/ 
          [project]/library/Zend
   • Install bin tools
        – sudo mv ~/ZendFramework­1.11.11 
          /usr/share/php/ZendFramework
        – alias
           zf=/usr/share/php/ZendFramework/bin/zf.sh
$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
MVC




$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Demo project for Layar

   • http://layar.com/
     It's mobile browser
     allows users to find
     various items based
     upon augmented
     reality technology.
   • https://github.com/ilbonzo/Wade

$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Create Project




$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Config Apps
       /application/configs/application.ini




$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Bootstrap
   /application/Bootstrap.php
   class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
   {
       protected function _initDoctype()
       {
           $this­>bootstrap('view');
           $view = $this­>getResource('view');
           $view­>doctype('HTML5');
       }
       .......
   }

$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Layouts
   • $ zf enable layout 
   •   /application/configs/application.ini
        – resources.layout.layoutPath = APPLICATION_PATH 
          "/layouts/scripts/"
   •   Twitter Bootstrap http://twitter.github.com/bootstrap/

                                 Other Layouts
                                 $this­>_helper­>layout­>setLayout('layout_other');




$incontro['pugBO'][7] = 'Introduction to Zend Framework'              http://magni.me
ZF overview

   • Models(db-
     tables,objectmodels)
   • Views(helpers,scripts,layouts)
   • Controllers(actions,helpers)
   • Forms




$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Namespace & Route

   • All classes named for their folder
     (e.g.Application_Model_Post in
     application/models/post.php)
   • Every Zend module is auto loaded when
     needed
   • Default controller/action is Index
   • URLformat: /<controller>/<action>

$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Controller & Actions
       $ zf create controller Point
       $ zf create action view Point
       $ zf create action add Point
       $ zf create action update Point
       $ zf create action delete Point
       create file /application/controllers/PointController.php
   class PointController extends Zend_Controller_Action
   {
       public function init()
       {
           /* Initialize action controller here */
       }
       public function indexAction()
      {
          // action body
      }
$incontro['pugBO'][7] = 'Introduction to Zend Framework'
    ...                                                           http://magni.me
Views e Actions

   • Create views
       /application/views/scripts/point/[action].phtml
       esempio:
       <br /><br />
       <div id="view­content">
       <p>View script for controller <b>Point</b> and 
       script/action name <b>add</b></p>
       </div>




$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Database

       /application/configs/application.ini
       PostgreSQL DB
       resources.db.adapter = PDO_PGSQL
       resources.db.params.host = localhost
       resources.db.params.username = postgres
       resources.db.params.password = 
       resources.db.params.dbname = wade




$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Zend_Db
       The Zend_Db_Table solution is an implementation of the
       Table Data Gateway pattern. The solution also includes a
       class that implements the Row Data Gateway pattern.




$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
DbTable - DbTableRow
    $ zf create db­table Points points
    $ zf create model Point

   /application/models/Point.php
   class Application_Model_Point extends Zend_Db_Table_Row_Abstract
   {
       function __get($key)
       {
           if (method_exists($this, $key)) {
               return $this­>$key();
           }
           return parent::__get($key);
       }
   }




$incontro['pugBO'][7] = 'Introduction to Zend Framework'              http://magni.me
Form - Validation
   $ zf create form Point

   /application/forms/Point.php
   class Application_Form_Point extends Zend_Form
   {
       public function init()
       {
           $title = new Zend_Form_Element_Text('title');
           $title­>setLabel('title')
                   ­>setRequired(true)
                   ­>addFilter('StripTags')
                   ­>addFilter('StringTrim')
                   ­>addValidator('NotEmpty');
       }
   }
$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Controller – Form
   /application/controllers/PointController.php
           $form = new Application_Form_Point();
           $form­>submit­>setLabel('Add');
           $this­>view­>form = $form;
           if ($this­>getRequest()­>isPost()) {
               $formData = $this­>getRequest()­>getPost();
               if ($form­>isValid($formData)) {
                   $title = $form­>getValue('title');
                   ....
                   $point = new Application_Model_DbTable_Points();
                   $point­>addPoint($title, $footnote, $description, $lat, $lon, 
   $alt);
                   $this­>_helper­>redirector('index');
               } else {
                   $form­>populate($formData);
               }
           }        
$incontro['pugBO'][7] = 'Introduction to Zend Framework'            http://magni.me
Views - Form
   /application/views/scripts/point/add.phtml
   <?php
   $this­>title = "Add new Point";
   $this­>headTitle($this­>title);
   echo $this­>form ;
   ?>




$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Models and Table
                       Relationships
class Application_Model_DbTable_Points extends Zend_Db_Table_Abstract
{  
    protected $_dependentTables = array('Application_Model_DbTable_Actions');
....


class Application_Model_DbTable_Actions extends Zend_Db_Table_Abstract
{
    protected $_name = 'actions';
    protected $_rowClass = 'Application_Model_Action';
    protected $_primary = 'id';
    
    protected $_referenceMap = array(
        'Application_Model_DbTable_Points' => array(
         'columns' => array('point_id'),
            'refTableClass' => 'Application_Model_DbTable_Points',
            'refColumns' => array('id')
        ),
$incontro['pugBO'][7] = 'Introduction to Zend Framework'                        http://magni.me
Component Library
     Zend_Acl
   •
     Zend_Amf
   •
     Zend_Application
   •
     Zend_Auth
   •
     Zend_Barcode
   •
     Zend_Cache
   •
     Zend_Captcha
   •
     --------
   •
     Zend_Config
   •
     Zend_Config_Writer
   •
     Zend_Controller
   •
     Zend_Currency
   •
     Zend_Date
   •
     Zend_Db
   •
     ----------
   •
     ZendX_JQuery
   •
$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Youtube
       https://developers.google.com/youtube/2.0/developers_guide_php




$incontro['pugBO'][7] = 'Introduction to Zend Framework'    http://magni.me
ZF & Drupal

       http://drupal.org/project/zend




  It's possible but Dries chose Symfony

$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me
Questions?



                           http://blog.ilbonzo.org
                          http://twitter.com/ilbonzo



$incontro['pugBO'][7] = 'Introduction to Zend Framework'   http://magni.me

Weitere ähnliche Inhalte

Was ist angesagt?

The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010
Fabien Potencier
 
Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2
Fabien Potencier
 

Was ist angesagt? (20)

Joomla! Components - Uma visão geral
Joomla! Components - Uma visão geralJoomla! Components - Uma visão geral
Joomla! Components - Uma visão geral
 
Phing101 or How to staff a build orchestra
Phing101 or How to staff a build orchestraPhing101 or How to staff a build orchestra
Phing101 or How to staff a build orchestra
 
Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5
 
Symfony2 - OSIDays 2010
Symfony2 - OSIDays 2010Symfony2 - OSIDays 2010
Symfony2 - OSIDays 2010
 
Zend Framework 2
Zend Framework 2Zend Framework 2
Zend Framework 2
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010
 
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new with PHP7
 
Symfony2 and AngularJS
Symfony2 and AngularJSSymfony2 and AngularJS
Symfony2 and AngularJS
 
Zend Framework 2 quick start
Zend Framework 2 quick startZend Framework 2 quick start
Zend Framework 2 quick start
 
Using Renderless Components in Vue.js during your software development.
Using Renderless Components in Vue.js during your software development.Using Renderless Components in Vue.js during your software development.
Using Renderless Components in Vue.js during your software development.
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
PHP MVC
PHP MVCPHP MVC
PHP MVC
 
Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 
A resource oriented framework using the DI/AOP/REST triangle
A resource oriented framework using the DI/AOP/REST triangleA resource oriented framework using the DI/AOP/REST triangle
A resource oriented framework using the DI/AOP/REST triangle
 
UA testing with Selenium and PHPUnit - PHPBenelux Summer BBQ
UA testing with Selenium and PHPUnit - PHPBenelux Summer BBQUA testing with Selenium and PHPUnit - PHPBenelux Summer BBQ
UA testing with Selenium and PHPUnit - PHPBenelux Summer BBQ
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 

Ähnlich wie Introduction to Zend framework

symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
patter
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
King Foo
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
funkatron
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf Conference
 
Dependency injection in Drupal 8
Dependency injection in Drupal 8Dependency injection in Drupal 8
Dependency injection in Drupal 8
Alexei Gorobets
 

Ähnlich wie Introduction to Zend framework (20)

Getting up & running with zend framework
Getting up & running with zend frameworkGetting up & running with zend framework
Getting up & running with zend framework
 
Getting up and running with Zend Framework
Getting up and running with Zend FrameworkGetting up and running with Zend Framework
Getting up and running with Zend Framework
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Introduction to Zend Framework
Introduction to Zend FrameworkIntroduction to Zend Framework
Introduction to Zend Framework
 
Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework Foundations
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
 
Complex Sites with Silex
Complex Sites with SilexComplex Sites with Silex
Complex Sites with Silex
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
Drehbuch zum Talk "Rapid Prototyping mit PHP Frameworks"
Drehbuch zum Talk "Rapid Prototyping mit PHP Frameworks"Drehbuch zum Talk "Rapid Prototyping mit PHP Frameworks"
Drehbuch zum Talk "Rapid Prototyping mit PHP Frameworks"
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 Developer
 
Dependency injection in Drupal 8
Dependency injection in Drupal 8Dependency injection in Drupal 8
Dependency injection in Drupal 8
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 

Mehr von Matteo Magni

Mehr von Matteo Magni (20)

Introduzione DevOps con Ansible
Introduzione DevOps con AnsibleIntroduzione DevOps con Ansible
Introduzione DevOps con Ansible
 
HTML5 e Css3 - 7 | WebMaster & WebDesigner
HTML5 e Css3 - 7 | WebMaster & WebDesignerHTML5 e Css3 - 7 | WebMaster & WebDesigner
HTML5 e Css3 - 7 | WebMaster & WebDesigner
 
HTML5 e Css3 - 6 | WebMaster & WebDesigner
HTML5 e Css3 - 6 | WebMaster & WebDesignerHTML5 e Css3 - 6 | WebMaster & WebDesigner
HTML5 e Css3 - 6 | WebMaster & WebDesigner
 
HTML5 e Css3 - 5 | WebMaster & WebDesigner
HTML5 e Css3 - 5 | WebMaster & WebDesignerHTML5 e Css3 - 5 | WebMaster & WebDesigner
HTML5 e Css3 - 5 | WebMaster & WebDesigner
 
HTML5 e Css3 - 4 | WebMaster & WebDesigner
HTML5 e Css3 - 4 | WebMaster & WebDesignerHTML5 e Css3 - 4 | WebMaster & WebDesigner
HTML5 e Css3 - 4 | WebMaster & WebDesigner
 
HTML5 e Css3 - 3 | WebMaster & WebDesigner
HTML5 e Css3 - 3 | WebMaster & WebDesignerHTML5 e Css3 - 3 | WebMaster & WebDesigner
HTML5 e Css3 - 3 | WebMaster & WebDesigner
 
HTML5 e Css3 - 2 | WebMaster & WebDesigner
HTML5 e Css3 - 2 | WebMaster & WebDesignerHTML5 e Css3 - 2 | WebMaster & WebDesigner
HTML5 e Css3 - 2 | WebMaster & WebDesigner
 
HTML5 e Css3 - 1 | WebMaster & WebDesigner
HTML5 e Css3 - 1 | WebMaster & WebDesigner HTML5 e Css3 - 1 | WebMaster & WebDesigner
HTML5 e Css3 - 1 | WebMaster & WebDesigner
 
jQuery - 5 | WebMaster & WebDesigner
jQuery - 5 | WebMaster & WebDesignerjQuery - 5 | WebMaster & WebDesigner
jQuery - 5 | WebMaster & WebDesigner
 
jQuery - 4 | WebMaster & WebDesigner
jQuery - 4 | WebMaster & WebDesignerjQuery - 4 | WebMaster & WebDesigner
jQuery - 4 | WebMaster & WebDesigner
 
jQuery - 3 | WebMaster & WebDesigner
jQuery - 3 | WebMaster & WebDesignerjQuery - 3 | WebMaster & WebDesigner
jQuery - 3 | WebMaster & WebDesigner
 
jQuery - 2 | WebMaster & WebDesigner
jQuery - 2 | WebMaster & WebDesignerjQuery - 2 | WebMaster & WebDesigner
jQuery - 2 | WebMaster & WebDesigner
 
jQuery - 1 | WebMaster & WebDesigner
jQuery - 1 | WebMaster & WebDesignerjQuery - 1 | WebMaster & WebDesigner
jQuery - 1 | WebMaster & WebDesigner
 
Javascript - 7 | WebMaster & WebDesigner
Javascript - 7 | WebMaster & WebDesignerJavascript - 7 | WebMaster & WebDesigner
Javascript - 7 | WebMaster & WebDesigner
 
Javascript - 6 | WebMaster & WebDesigner
Javascript - 6 | WebMaster & WebDesignerJavascript - 6 | WebMaster & WebDesigner
Javascript - 6 | WebMaster & WebDesigner
 
Javascript - 5 | WebMaster & WebDesigner
Javascript - 5 | WebMaster & WebDesignerJavascript - 5 | WebMaster & WebDesigner
Javascript - 5 | WebMaster & WebDesigner
 
Javascript - 4 | WebMaster & WebDesigner
Javascript - 4 | WebMaster & WebDesignerJavascript - 4 | WebMaster & WebDesigner
Javascript - 4 | WebMaster & WebDesigner
 
Javascript - 3 | WebMaster & WebDesigner
Javascript - 3 | WebMaster & WebDesignerJavascript - 3 | WebMaster & WebDesigner
Javascript - 3 | WebMaster & WebDesigner
 
Javascript - 2 | WebMaster & WebDesigner
Javascript - 2 | WebMaster & WebDesignerJavascript - 2 | WebMaster & WebDesigner
Javascript - 2 | WebMaster & WebDesigner
 
Javascript - 1 | WebMaster & WebDesigner
Javascript - 1 | WebMaster & WebDesignerJavascript - 1 | WebMaster & WebDesigner
Javascript - 1 | WebMaster & WebDesigner
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Introduction to Zend framework

  • 1. Zend Framework 1.x $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 2. whoami • Matteo Magni • @ilbonzo • https://github.com/ilbonzo • http://it.linkedin.com/in/matteomagni $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 3. Zend Framework 1.X • Zend Framework is an open source, object oriented web application framework for PHP 5. Zend Framework is often called a 'component library', because it has many loosely coupled components that you can use more or less independently. • http://framework.zend.com/ • BSD license • Version 1.11 $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 4. Installation • Register and download source • Add to your include path – sudo mv ~/ZendFramework­1.11.11/library/Zend/  /usr/share/php/Zend OR – sudo mv ~/ZendFramework­1.11.11/library/Zend/  [project]/library/Zend • Install bin tools – sudo mv ~/ZendFramework­1.11.11  /usr/share/php/ZendFramework – alias zf=/usr/share/php/ZendFramework/bin/zf.sh $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 5. MVC $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 6. Demo project for Layar • http://layar.com/ It's mobile browser allows users to find various items based upon augmented reality technology. • https://github.com/ilbonzo/Wade $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 7. Create Project $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 8. Config Apps /application/configs/application.ini $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 9. Bootstrap /application/Bootstrap.php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {     protected function _initDoctype()     {         $this­>bootstrap('view');         $view = $this­>getResource('view');         $view­>doctype('HTML5');     }     ....... } $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 10. Layouts • $ zf enable layout  • /application/configs/application.ini – resources.layout.layoutPath = APPLICATION_PATH  "/layouts/scripts/" • Twitter Bootstrap http://twitter.github.com/bootstrap/ Other Layouts $this­>_helper­>layout­>setLayout('layout_other'); $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 11. ZF overview • Models(db- tables,objectmodels) • Views(helpers,scripts,layouts) • Controllers(actions,helpers) • Forms $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 12. Namespace & Route • All classes named for their folder (e.g.Application_Model_Post in application/models/post.php) • Every Zend module is auto loaded when needed • Default controller/action is Index • URLformat: /<controller>/<action> $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 13. Controller & Actions $ zf create controller Point $ zf create action view Point $ zf create action add Point $ zf create action update Point $ zf create action delete Point create file /application/controllers/PointController.php class PointController extends Zend_Controller_Action {     public function init()     {         /* Initialize action controller here */     }     public function indexAction()    {        // action body    } $incontro['pugBO'][7] = 'Introduction to Zend Framework'  ... http://magni.me
  • 14. Views e Actions • Create views /application/views/scripts/point/[action].phtml esempio: <br /><br /> <div id="view­content"> <p>View script for controller <b>Point</b> and  script/action name <b>add</b></p> </div> $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 15. Database /application/configs/application.ini PostgreSQL DB resources.db.adapter = PDO_PGSQL resources.db.params.host = localhost resources.db.params.username = postgres resources.db.params.password =  resources.db.params.dbname = wade $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 16. Zend_Db The Zend_Db_Table solution is an implementation of the Table Data Gateway pattern. The solution also includes a class that implements the Row Data Gateway pattern. $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 17. DbTable - DbTableRow $ zf create db­table Points points $ zf create model Point /application/models/Point.php class Application_Model_Point extends Zend_Db_Table_Row_Abstract {     function __get($key)     {         if (method_exists($this, $key)) {             return $this­>$key();         }         return parent::__get($key);     } } $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 18. Form - Validation $ zf create form Point /application/forms/Point.php class Application_Form_Point extends Zend_Form {     public function init()     {         $title = new Zend_Form_Element_Text('title');         $title­>setLabel('title')                 ­>setRequired(true)                 ­>addFilter('StripTags')                 ­>addFilter('StringTrim')                 ­>addValidator('NotEmpty');     } } $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 19. Controller – Form /application/controllers/PointController.php         $form = new Application_Form_Point();         $form­>submit­>setLabel('Add');         $this­>view­>form = $form;         if ($this­>getRequest()­>isPost()) {             $formData = $this­>getRequest()­>getPost();             if ($form­>isValid($formData)) {                 $title = $form­>getValue('title');                 ....                 $point = new Application_Model_DbTable_Points();                 $point­>addPoint($title, $footnote, $description, $lat, $lon,  $alt);                 $this­>_helper­>redirector('index');             } else {                 $form­>populate($formData);             }         }         $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 20. Views - Form /application/views/scripts/point/add.phtml <?php $this­>title = "Add new Point"; $this­>headTitle($this­>title); echo $this­>form ; ?> $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 21. Models and Table Relationships class Application_Model_DbTable_Points extends Zend_Db_Table_Abstract {       protected $_dependentTables = array('Application_Model_DbTable_Actions'); .... class Application_Model_DbTable_Actions extends Zend_Db_Table_Abstract {     protected $_name = 'actions';     protected $_rowClass = 'Application_Model_Action';     protected $_primary = 'id';          protected $_referenceMap = array(         'Application_Model_DbTable_Points' => array(          'columns' => array('point_id'),             'refTableClass' => 'Application_Model_DbTable_Points',             'refColumns' => array('id')         ), $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 22. Component Library Zend_Acl • Zend_Amf • Zend_Application • Zend_Auth • Zend_Barcode • Zend_Cache • Zend_Captcha • -------- • Zend_Config • Zend_Config_Writer • Zend_Controller • Zend_Currency • Zend_Date • Zend_Db • ---------- • ZendX_JQuery • $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 23. Youtube https://developers.google.com/youtube/2.0/developers_guide_php $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 24. ZF & Drupal http://drupal.org/project/zend It's possible but Dries chose Symfony $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me
  • 25. Questions? http://blog.ilbonzo.org http://twitter.com/ilbonzo $incontro['pugBO'][7] = 'Introduction to Zend Framework' http://magni.me