• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Introduction to Zend framework
 

Introduction to Zend framework

on

  • 1,720 views

$incontro['pugBO'][7] = 'Introduction to Zend Framework'

$incontro['pugBO'][7] = 'Introduction to Zend Framework'

Introduction to Zend Framework 1.x for pugBO

Statistics

Views

Total Views
1,720
Views on SlideShare
1,630
Embed Views
90

Actions

Likes
1
Downloads
27
Comments
0

5 Embeds 90

http://blog.ilbonzo.org 57
http://bologna.grusp.org 20
http://www.linkedin.com 7
http://magni.me 5
http://feeds.feedburner.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Introduction to Zend framework Introduction to Zend framework Presentation Transcript

    • 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/ Its 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 Relationshipsclass 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 Its 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