Introduction to Zend Framework

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

4 comments

Comments 1 - 4 of 4 previous next Post a comment

  • + DragonBe Michelangelo van Dam 2 years ago
    The reason why I don’t use the auto load feature in my slides is to indicate the components that are being used. Of course you can enable auto loading and tweak other features as well, but that’s a matter of personal taste.
  • + guest69aa54 guest69aa54 2 years ago
    Dear Michelangelo,



    As a freetime webdeveloper I’m trying to learn as much as possible about ZFW.

    Sofar I’ve followed many tuts around the web and learned some about it.

    It’s only that as many tuts that are around, different approaches too.

    What I found in yours,is that you are not using Zend_loader to load the needed files automatically in your bootstrap.

    Has that a reason or is it just a choice?

    Anyhow thanks for this great tutorial.

    Aad Pouw (dutch)
  • + guest22b6b0 guest22b6b0 2 years ago
    Very nice tutorial, it’s a nice summary for everyone that wants to start off in Zend Framework, also check out this guys Zend_Form slides.
    Greets by your colleague Koen!
  • + csixty4 Dave Ross 2 years ago
    Very cool! I’ve only messed with the Zend_Pdf classes in the framework so far. But, the layout & MVC stuff you show here looks pretty cool. I’ll have to give it a try.
Post a comment
Embed Video
Edit your comment Cancel

10 Favorites & 2 Groups

Introduction to Zend Framework - Presentation Transcript

  1. Zend Framework Introduction by Michelangelo van Dam
  2. Who is Michelangelo van Dam ?
    • Freelance PHP consultant with over 7 years of enterprise level PHP development experience.
    • Started using Zend Framework in 2007 and contributes to this framework for Zend_Ldap.
    • web: http://www.in2it.be
    • blog: http://dragonbe.blogspot.com
    • e-mail: dragonbe [at] google mail
    • twitter: http://twitter.com/DragonBe
  3. What is Zend Framework ?
    • a component based framework
      • use the whole framework
      • pick what you need, drop the rest
    • implementing the MVC-paradigm
    • simplicity and object oriented best practices
    • corporate friendly license (new BSD license)
    • a very tested agile code base
    • modify code by extending components
  4. Zend Framework map
  5. Tools to build ZF applications
    • IDE's
      • Zend Studio 6.0 (“neon”) (www.zend.com)
        • fully supported by Zend
        • integration of Zend Framework in IDE
      • Komodo IDE (www.activestate.com)
    • Text editors
      • vi(m)
      • textpad
      • notepad
  6. A bit of theory... MVC
    • model
      • the model holds the business logic
    • view
      • creates the presentation layer
    • controller
      • defines actions to be executed
  7. MVC in action
  8. Setting up the virtualhost (Apache) <VirtualHost *:80> ServerName www.example.com ServerAlias example.com DocumentRoot /path/to/example.com/htdocs <Directory /path/to/example.com/htdocs> Options Indexes FollowSymlinks AllowOverride All Order allow,deny Allow from all DirectoryIndex index.php </Directory> SetEnv ENVPHP localhost ErrorLog /path/to/logs/example.com-error_log CustomLog /path/to/logs/example.com-access_log common </VirtualHost>
  9. Directory structure app/ default/ <- the &quot;default&quot; application controllers/ <- here you define your controllers ErrorController.php IndexController.php models/ <- this is where your business logic is put views/ <- everything for presentations is put here helpers/ scripts/ index/ index.phtml error/ index.phtml library/ Zend/ <- this is the Zend Framework library htdocs/ <- this is where your bootstrap file is located images/ scripts/ styles/ .htaccess index.php
  10. modify apache settings .htaccess RewriteEngine on RewriteRule !.(js|ico|gif|jpg|png|css)$ index.php
  11. bootstrap file index.php /** * Setup controller */ $controller = Zend_Controller_Front::getInstance(); $controller ->setControllerDirectory( '../application/default/controllers' ); $controller ->throwExceptions( false ); // should be turned on in development time // run! $controller ->dispatch(); require_once 'Zend/Controller/Front.php' ; <?php /** * My new Zend Framework project * * @author Michelangelo van Dam (michelangelo@in2it.be) * @version $Id$ */ set_include_path( '.' . PATH_SEPARATOR . '../library' . PATH_SEPARATOR . '../application/default/models/' . PATH_SEPARATOR . get_include_path() );
  12. view script index/index.phtml <?php /** * Default home page view * * @author Micehlangelo van Dam (michelangelo@in2it.be) * @version $Id$ */ echo '<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>' ; ?> <! DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot; > < html xmlns = &quot;http://www.w3.org/1999/xhtml&quot; > < head > < meta http-equiv = &quot;Content-Type&quot; content = &quot;text/html; charset=UTF-8&quot; /> < title > New Zend Framework Project </ title > </ head > < body > Hello, world! </ body > </ html >
  13. controller IndexController.php <?php /** * IndexController - The default controller class * * @author Michelangelo van Dam (michelangelo@in2it.be) * @version $Id$ */ require_once 'Zend/Controller/Action.php' ; class IndexController extends Zend_Controller_Action { /** * The default action - show the home page */ public function indexAction() { // TODO Auto-generated IndexController::indexAction() action } }
  14. that's it !
  15. implementing Zend_Layout app/ default/ controllers/ models/ views/ helpers/ layouts/ layout.phtml <- here you define the site layout scripts/ index/ error/ library/ Zend/ htdocs/ images/ scripts/ styles/ .htaccess index.php
  16. modifying bootstrap index.php /** * Setup controller */ $controller = Zend_Controller_Front::getInstance(); $controller ->setControllerDirectory( '../application/default/controllers' ); $controller ->throwExceptions( false ); // should be turned on in development time // We enable Zend_Layout Zend_Layout::startMvc(array( 'layoutPath' => '../app/views/layouts' )); // run! $controller ->dispatch(); require_once 'Zend/Controller/Front.php' ; <?php /** * My new Zend Framework project * * @author Michelangelo van Dam (michelangelo@in2it.be) * @version $Id$ */ set_include_path( '.' . PATH_SEPARATOR . '../library' . PATH_SEPARATOR . '../application/default/models/' . PATH_SEPARATOR . get_include_path() );
  17. site layout with layout.phtml <?php echo '<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>' ; ?> <?php echo $this ->doctype( 'XHTML1_TRANSITIONAL' ); ?> < html xmlns = &quot;http://www.w3.org/1999/xhtml&quot; > < head > <?php echo $this ->headMeta()->appendHttpEquiv( 'Content-Type' , 'text/html; Charset=UTF-8' ); ?> <?php echo $this ->headTitle(); ?> </ head > < body > <?php echo $this ->layout()->content; ?> </ body > </ html >
  18. modifying index/index.phtml Hello, world!
  19. modifying IndexController.php <?php /** * IndexController - The default controller class * * @author Michelangelo van Dam (michelangelo@in2it.be) * @version $Id$ */ require_once 'Zend/Controller/Action.php' ; class IndexController extends Zend_Controller_Action { /** * The default action - show the home page */ public function indexAction() { $this ->headTitle( 'New Zend Framework Application' ); } }
  20. Result is the same, but better
  21. More information
    • Zend Framework website http://framework.zend.com
    • Zend Developer Zone http://devzone.zend.com
    • ZFTutorials forum http://www.zftutorials.com
    • Blogs
      • Matthew Weier O'Phinney: http://weierophinney.net/matthew
      • Cal Evans: http://blog.calevans.com
      • Andries Seutens: http://andries.systray.be/blog
      • Rob Allen: http://akrabat.com
  22. Further reading
    • Guide to Programming with Zend Framework
    • written by: Cal Evans
    • published by: php|arch ( http://phparch.com )
    • Zend Framework in Action
    • written by: Rob Allen, Nick Lo, Steven Brown
    • published by: Manning Publications ( http://manning.com )
  23. Additional notes
    • This presentation can be found on SlideShare
    • http://www.slideshare.net/DragonBe/introduction-to-zend-framework/
    • On IRC ( irc.freenode.net ) you can go to #zftalk to chat about Zend Framework
    • Team up with the Belgian PHP Community on http://phpbelgium.be
  24. Thank you... Any Questions ???

+ Michelangelo van DamMichelangelo van Dam, 2 years ago

custom

9231 views, 10 favs, 12 embeds more stats

An introduction to writing a simple Zend Framework more

More info about this document

CC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs License

Go to text version

  • Total Views 9231
    • 9039 on SlideShare
    • 192 from embeds
  • Comments 4
  • Favorites 10
  • Downloads 417
Most viewed embeds
  • 82 views on http://mauriziostorani.wordpress.com
  • 79 views on http://www.dragonbe.com
  • 12 views on http://www.planet-php.net
  • 9 views on http://dragonbe.blogspot.com
  • 2 views on http://www.planet-php.org

more

All embeds
  • 82 views on http://mauriziostorani.wordpress.com
  • 79 views on http://www.dragonbe.com
  • 12 views on http://www.planet-php.net
  • 9 views on http://dragonbe.blogspot.com
  • 2 views on http://www.planet-php.org
  • 2 views on http://localhost
  • 1 views on http://forum.fcicafe.com
  • 1 views on http://sireesh.blog.co.in
  • 1 views on http://feeds.feedburner.com
  • 1 views on http://209.85.137.132
  • 1 views on http://safe.tumblr.com
  • 1 views on http://ple2.tumblr.com

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories

Groups / Events