SlideShare a Scribd company logo
Zend Framework Introduction by Michelangelo van Dam
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
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
Zend Framework map
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
A bit of theory... MVC model the model holds the business logic view creates the presentation layer controller defines actions to be executed
MVC in action
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>
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
modify apache settings .htaccess RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
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() );
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 >
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 } }
that's it !
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
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() );
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 >
modifying index/index.phtml Hello, world!
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' ); } }
Result is the same, but better
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
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 )
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
Thank you... Any Questions ???

More Related Content

PPT
Zend Framework Introduction
Rafael Monteiro
 
ODP
Using Zend Framework 2 Book Presentation
olegkrivtsov
 
PDF
Deprecated: Foundations of Zend Framework 2
Adam Culp
 
PPTX
Intro to Angular.js & Zend2 for Front-End Web Applications
TECKpert, Hubdin
 
PDF
Zend Framework 2, What's new, Confoo 2011
Bachkoutou Toutou
 
PDF
A quick start on Zend Framework 2
Enrico Zimuel
 
PPT
2007 Zend Con Mvc Edited Irmantas
Irmantas Šiupšinskas
 
PPT
Using Zend_Tool to Establish Your Project's Skeleton
Jeremy Brown
 
Zend Framework Introduction
Rafael Monteiro
 
Using Zend Framework 2 Book Presentation
olegkrivtsov
 
Deprecated: Foundations of Zend Framework 2
Adam Culp
 
Intro to Angular.js & Zend2 for Front-End Web Applications
TECKpert, Hubdin
 
Zend Framework 2, What's new, Confoo 2011
Bachkoutou Toutou
 
A quick start on Zend Framework 2
Enrico Zimuel
 
2007 Zend Con Mvc Edited Irmantas
Irmantas Šiupšinskas
 
Using Zend_Tool to Establish Your Project's Skeleton
Jeremy Brown
 

What's hot (17)

PPTX
Django Interview Questions and Answers
Python Devloper
 
PPTX
Zend con 2016 bdd with behat for beginners
Adam Englander
 
PDF
Apigility – Lightning Fast API Development - OSSCamp 2014
OSSCube
 
KEY
Extending Zend_Tool
Ralph Schindler
 
PDF
Php Dependency Management with Composer ZendCon 2016
Clark Everetts
 
PPTX
Django - Python MVC Framework
Bala Kumar
 
PDF
Criando aplicações RestFul com Zend Framework 2
Elton Minetto
 
PDF
Writing Services with ZF2
Mike Willbanks
 
ODP
PHP Quality Assurance Workshop PHPBenelux
Nick Belhomme
 
PPT
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Tikal Knowledge
 
PPTX
Lecture java basics
eleksdev
 
PDF
Zend Framework 1.8 workshop
Nick Belhomme
 
PPTX
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Steven Pignataro
 
PDF
Android develop guideline
Kan-Han (John) Lu
 
PDF
Django Documentation
Ying wei (Joe) Chou
 
ODP
Ant User Guide
Muthuselvam RS
 
PDF
Building Rich Applications with Appcelerator
Matt Raible
 
Django Interview Questions and Answers
Python Devloper
 
Zend con 2016 bdd with behat for beginners
Adam Englander
 
Apigility – Lightning Fast API Development - OSSCamp 2014
OSSCube
 
Extending Zend_Tool
Ralph Schindler
 
Php Dependency Management with Composer ZendCon 2016
Clark Everetts
 
Django - Python MVC Framework
Bala Kumar
 
Criando aplicações RestFul com Zend Framework 2
Elton Minetto
 
Writing Services with ZF2
Mike Willbanks
 
PHP Quality Assurance Workshop PHPBenelux
Nick Belhomme
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Tikal Knowledge
 
Lecture java basics
eleksdev
 
Zend Framework 1.8 workshop
Nick Belhomme
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Steven Pignataro
 
Android develop guideline
Kan-Han (John) Lu
 
Django Documentation
Ying wei (Joe) Chou
 
Ant User Guide
Muthuselvam RS
 
Building Rich Applications with Appcelerator
Matt Raible
 
Ad

Similar to Introduction to Zend Framework (20)

PPT
Getting Started with Zend Framework
Juan Antonio
 
PPT
Zend - Installation And Sample Project Creation
Compare Infobase Limited
 
PPTX
Zend framework
Prem Shankar
 
PPT
2007 Zend Con Mvc
Pablo Morales
 
PPTX
My Very First Zf App Part One
isaaczfoster
 
ODP
Zend Framework 1.9 Setup & Using Zend_Tool
Gordon Forsythe
 
PPT
Edp bootstrapping a-software_company
Ganesh Kulkarni
 
PDF
Zend Framework Quick Start Walkthrough
Bradley Holt
 
PPTX
Web application development using zend framework
Sayed Ahmed
 
PPT
Introduction to Zend Framework
Jamie Hurst
 
PPTX
Get Started with Zend Framework 2
Mindfire Solutions
 
PDF
Building Web Applications with Zend Framework
Phil Brown
 
KEY
Inside Zend Framework
Weng Wei
 
PPT
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Nguyen Duc Phu
 
PPT
How to learn to build your own PHP framework
Dinh Pham
 
PDF
Introduction to Zend framework
Matteo Magni
 
PDF
Zend Framework 2 - presentation
yamcsha
 
PDF
Getting started-with-zend-framework
Nilesh Bangar
 
Getting Started with Zend Framework
Juan Antonio
 
Zend - Installation And Sample Project Creation
Compare Infobase Limited
 
Zend framework
Prem Shankar
 
2007 Zend Con Mvc
Pablo Morales
 
My Very First Zf App Part One
isaaczfoster
 
Zend Framework 1.9 Setup & Using Zend_Tool
Gordon Forsythe
 
Edp bootstrapping a-software_company
Ganesh Kulkarni
 
Zend Framework Quick Start Walkthrough
Bradley Holt
 
Web application development using zend framework
Sayed Ahmed
 
Introduction to Zend Framework
Jamie Hurst
 
Get Started with Zend Framework 2
Mindfire Solutions
 
Building Web Applications with Zend Framework
Phil Brown
 
Inside Zend Framework
Weng Wei
 
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Nguyen Duc Phu
 
How to learn to build your own PHP framework
Dinh Pham
 
Introduction to Zend framework
Matteo Magni
 
Zend Framework 2 - presentation
yamcsha
 
Getting started-with-zend-framework
Nilesh Bangar
 
Ad

More from Michelangelo van Dam (20)

PDF
GDPR Art. 25 - Privacy by design and default
Michelangelo van Dam
 
PDF
Moving from app services to azure functions
Michelangelo van Dam
 
PDF
Privacy by design
Michelangelo van Dam
 
PDF
DevOps or DevSecOps
Michelangelo van Dam
 
PDF
Privacy by design
Michelangelo van Dam
 
PDF
Continuous deployment 2.0
Michelangelo van Dam
 
PDF
Let your tests drive your code
Michelangelo van Dam
 
PDF
General Data Protection Regulation, a developer's story
Michelangelo van Dam
 
PDF
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
PDF
The road to php 7.1
Michelangelo van Dam
 
PDF
Open source for a successful business
Michelangelo van Dam
 
PDF
Decouple your framework now, thank me later
Michelangelo van Dam
 
PDF
Deploy to azure in less then 15 minutes
Michelangelo van Dam
 
PDF
Azure and OSS, a match made in heaven
Michelangelo van Dam
 
PDF
Getting hands dirty with php7
Michelangelo van Dam
 
PDF
Zf2 how arrays will save your project
Michelangelo van Dam
 
PDF
Create, test, secure, repeat
Michelangelo van Dam
 
PDF
The Continuous PHP Pipeline
Michelangelo van Dam
 
PDF
PHPUnit Episode iv.iii: Return of the tests
Michelangelo van Dam
 
PDF
Easily extend your existing php app with an api
Michelangelo van Dam
 
GDPR Art. 25 - Privacy by design and default
Michelangelo van Dam
 
Moving from app services to azure functions
Michelangelo van Dam
 
Privacy by design
Michelangelo van Dam
 
DevOps or DevSecOps
Michelangelo van Dam
 
Privacy by design
Michelangelo van Dam
 
Continuous deployment 2.0
Michelangelo van Dam
 
Let your tests drive your code
Michelangelo van Dam
 
General Data Protection Regulation, a developer's story
Michelangelo van Dam
 
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
The road to php 7.1
Michelangelo van Dam
 
Open source for a successful business
Michelangelo van Dam
 
Decouple your framework now, thank me later
Michelangelo van Dam
 
Deploy to azure in less then 15 minutes
Michelangelo van Dam
 
Azure and OSS, a match made in heaven
Michelangelo van Dam
 
Getting hands dirty with php7
Michelangelo van Dam
 
Zf2 how arrays will save your project
Michelangelo van Dam
 
Create, test, secure, repeat
Michelangelo van Dam
 
The Continuous PHP Pipeline
Michelangelo van Dam
 
PHPUnit Episode iv.iii: Return of the tests
Michelangelo van Dam
 
Easily extend your existing php app with an api
Michelangelo van Dam
 

Recently uploaded (20)

PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
Chapter 1 Introduction to CV and IP Lecture Note.pdf
Getnet Tigabie Askale -(GM)
 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Chapter 1 Introduction to CV and IP Lecture Note.pdf
Getnet Tigabie Askale -(GM)
 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
Doc9.....................................
SofiaCollazos
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Coupa-Overview _Assumptions presentation
annapureddyn
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 

Introduction to Zend Framework

  • 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
  • 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
  • 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 ([email protected]) * @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 ([email protected]) * @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 ([email protected]) * @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 } }
  • 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 ([email protected]) * @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 >
  • 19. modifying IndexController.php <?php /** * IndexController - The default controller class * * @author Michelangelo van Dam ([email protected]) * @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 ???