Synapseindia php development presenation on zend framework quick start

Page 1

Zend Framework Quick start


Zend Framework quick start 1. 2. 3. 4. 5.

Design patterns MVC design patterns Directory Structure Bootstrap Hello world example


Design patterns a design pattern is a general reusable solution to a commonly occurring problem in software design. en.wikipedia.org/wiki/Design_pattern_(com puter_science)) (


MVC design patterns Model-View-Controller (MVC) is a design pattern that simplifies application development and maintenance. 1. Model: Responsible for the business logic of an application 2. View: Typically what would be considered web design, or templating. 3. Controller: The controller layer glues everything together.


Directory structure


Bootstrap (index.php)


Hello world with ZF MVC We have done basic configuration. It time to have fun‌. In your application/controllers/IndexController.php <? class IndexController extends Zend_Ctontroller_Action { public function indexAction() { } } ?>


Hello world cont… Next in your application/views/ Create views/index/index.phtml And write <html> <body> Hello world………….. </body> </html>


Using Models In application/models Write <? class Math { public function __construct() { } public function sum($val1,$val2) { return $val1 + $val2; } } ?>


Model cont.. Now in controller, write <? class IndexController extends Zend_Ctontroller Action { public function indexAction() { $math = new Math(); $sum = $math->sum(5,10); $this->view->sum=$sum; } } ?>


Example cont… And finally in your view(application/view/scripts/index/index.ph tml) Write, <? echo ‘sum is ’ . $this->sum; ?>


Thanks Next….. Two step view Zend_Db_Configuration And many more…..


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.