SlideShare a Scribd company logo
1 of 31
Intro
• A web application framework written in PHP5

• Loosely coupled set of modules that perform various
Tasks

‣ Database access (Zend_DB)

‣ Google Data API‟s (Zend_Gdata)

• Easy to implement MVC model
What is MVC?
• MVC stands for Model-View-Controller
       ‣ Code is divided into three distinct groups

• Model -- Internal representation of data, interface
       to backend storage (i.e. database), and
       “business logic”

• View -- Code that represents the application‟s UI

• Controller -- Code that generates output to
        populate the view using the model
•Download    latest zend frame work

•It   contains two folders “bin” and “library".
           Copy that to wamp/bin/php/=>newfolder say zend_frame.

•Change    the include_path for windows in php.ini to
           wamp/bin/php/zend_frame/library

Now zend is installed…

to check zend is installed or not
---------------
 Take cmd prompt and-> type zf show version
 If its displaying the correct version,
          Your Zend is functioning
Take cmd => go to your local host folder
      here its wamp/www/

Type=> zf create project Zendy

                          projectname

Your project is created….you can check in the www
folder….
Also copy the folder zend in the library to this project`s
library
ZEND PROJECT SKELTON
• application/Bootstrap.php
         ‣ Application bootstrap code
• application/configs
         ‣ Configuration files
• application/controllers
         ‣ Backend controller code
• application/models
         ‣ Code mapping from domain
data     to storage data (PHP interface
to DB
         for example)
• application/views/scripts
         ‣ User interface code
• application/configs/application.ini
         ‣ Main configuration file
• application/controllers/
         ‣ ErrorController.php
-> Default controller called when an
error occurs
         ‣ IndexController.php
->Default controller when no
controller is specified
You can go to your project by typing localhost/zendy/public on your browser

      Your project frontage will be like this:
A controller that handles all requests for a Web site.

   Zend_Controller_Front
   implements a Front Controller
   pattern used in Model-View-
   Controller (MVC) applications.

    Its purpose is to initialize the
   request environment, route the
   incoming request, and then
   dispatch any discovered actions;
   it aggregates any responses and
   returns them when the process is
   complete.
The index.php file is the entry point to our application and is used
to create an instance of Zend_Application to initialise our
application and then run it. This file also defines two constants:
APPLICATION_PATH and APPLICATION_ENV which define the path
to the application/ directory and the environment or mode of the
application. The default is set to production in index.php, but you
should set it to development in the .htaccess file by adding this
line:    SetEnv APPLICATION_ENV development
E:wampwwwzendbinapplicationviewsscriptsindex
Adding a New Action
• When forms are submitted, there is some backend
code that processes the input
‣ We will handle this in a new action within the
Indexcontroller
‣ We use the „zf‟ tool to create the relevant code stubs
 zf create action actionname controllername
Eg: zf create action about index

• This creates the function aboutAction() in
application/controllers/IndexController.php
      class IndexController extends Zend_Controller_Action
               {
                      public function addAction()
                               {
                                /* Initialize action controller here */
                               }
EXAMPLE FOR ZEND

   Page                    Controller               Action

   Home page               Index                    index
   Add new album           Index                    add
   Edit album              Index                    edit
   Delete album            Index                    delete


   And the data fields are id(auto increment) ,artist and album
Actions
     zf create action add Index
     zf create action edit Index
     zf create action delete Index
  The URLs for each action are:

  http://localhost/zf-tutorial/public/
           IndexController::indexAction()
  http://localhost/zf-tutorial/public/index/add
           IndexController::addAction()
  http://localhost/zf-tutorial/public/index/edit
           IndexController::editAction()
  http://localhost/zf-tutorial/public/index/delete
            IndexController::deleteAction()

class IndexController extends Zend_Controller_Action
                {
                         public function addAction()
                                   {
                          /* Initialize action controller here*/
                                   }
Database configuration
Open application/configs/application.ini and add the following to the
end of the
[production] section (i.e. above the [staging] section):
resources.db.adapter = “PDO_MYSQL”
resources.db.params.host = “localhost”
resources.db.params.username = “root”
resources.db.params.password = “”
resources.db.params.dbname = “zend”
Create the database table
CREATE TABLE albums (id int(11) NOT NULL auto_increment,artist
varchar(100) NOT NULL,title varchar(100) NOT NULL,PRIMARY KEY
(id));


  Inserting test data
 INSERT INTO albums (artist, title) VALUES
 ('Paolo Nutine', 'Sunny Side Up„),
 ('Florence + The Machine', 'Lungs'),
 ('Massive Attack', 'Heligoland'),
 ('Andre Rieu', 'Forever Vienna'),
 ('Sade', 'Soldier of Love');
The MODEL
Zend Framework provides Zend_Db_Table which implements the
Table Data
Gateway design pattern to allow for interfacing with data in a
database table.
For this tutorial, we are going to create a model that extends
Zend_Db_Table and uses Zend_Db_Table_Row.

   zf create db-table Albums albums

   <?php
      class Application_Model_DbTable_Albums extends
      Zend_Db_Table_Abstract
      {
          protected $_name = 'albums';
      }
      ?>
Layouts and views

Zend_Layout allows us to move all the common header, footer and other
code to a layout view script which then includes the specific view code for
the action being executed.
                         Zf enable layout


Zendy/application/layouts/scripts/layout.phtml



    To get the view script for the current action to display, we echo
    out the content placeholder using the layout() view helper: echo
    $this->layout()->content; which does the work for us.
We need to set the doctype for the webpage before we render any view scripts.
As the action view scripts are rendered earlier and may need to know which
doctype is in force. This is especially true for Zend_Form.


To set the doctype we add another line to our application.ini, in the [production]
section:

resources.view.doctype = "XHTML1_STRICT“
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

The doctype() view helper will now output the correct doctype and components
like Zend_Form willgenerate compatible HTML.
Styling
    Styling is done by making css file in ZENDY/public/css/site.css
     And then include that file inside the layout


 <?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/site.css'); ?>


By using headLink()‟s prependStylesheet() method, we allow for additional,
 more specific, CSS files to be added within the controller view scripts which
 will be rendered within the <head> section after site.css
To display all the dats in the index page…..
zf-tutorial/application/controllers/IndexController.php
...
function indexAction()
{
$albums = new Application_Model_DbTable_Albums();
$this->view->albums = $albums->fetchAll();
}
…
zf-tutorial/application/views/scripts/index/index.phtml

 <?php foreach($this->albums as $album) : ?>

 <td><?php echo $this->escape($album->title);?></td>
 <td><?php echo $this->escape($album->artist);?></td>
 <a href="<?php echo $this->url(array('controller'=>'index',
          'action'=>'edit', 'id'=>$album->id));?>">Edit</a>
 <a href="<?php echo $this->url(array('controller'=>'index',
          'action'=>'delete', 'id'=>$album->id));?>">Delete</a>

 <?php endforeach; ?>
Adding new albums
 There are two bits to this part:
 • Display a form for user to provide details
 • Process the form submission and store to database

                zf create form Album
This creates the file Album.php in application/forms
Zend Form
<?php

ADD action   $this->title = "Add new album";
             $this->headTitle($this->title)
             ;echo $this->form ;
             ?>
EDIT ACTION
zf-tutorial/application/views/scripts/index/edit.phtml

<?php
$this->title = "Edit album";
$this->headTitle($this->title);
echo $this->form ;
?>




                                                  DELETE ACTION
That‟s all………….
This concludes our brief look at building a simple, but
fully functional, MVC application using Zend Framework.



•Zend framework is loosely packed ,but more secure

More Related Content

What's hot

What happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingWhat happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingJace Ju
 
深入淺出 MVC
深入淺出 MVC深入淺出 MVC
深入淺出 MVCJace Ju
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockCaldera Labs
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Caldera Labs
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST APICaldera Labs
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST APICaldera Labs
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersCaldera Labs
 
Codeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsCodeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsAbdul Malik Ikhsan
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCalderaLearn
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWP Engine UK
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgnitermirahman
 
How do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML TricksHow do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML TricksCompare Infobase Limited
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Elena Kolevska
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecturepostrational
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswanivvaswani
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 

What's hot (20)

What happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingWhat happens in laravel 4 bootstraping
What happens in laravel 4 bootstraping
 
深入淺出 MVC
深入淺出 MVC深入淺出 MVC
深入淺出 MVC
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Codeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsCodeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework Components
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
How do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML TricksHow do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML Tricks
 
Phinx talk
Phinx talkPhinx talk
Phinx talk
 
Kyiv.py #17 Flask talk
Kyiv.py #17 Flask talkKyiv.py #17 Flask talk
Kyiv.py #17 Flask talk
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 

Similar to Zend framework

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_ToolGordon Forsythe
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-frameworkNilesh Bangar
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-frameworkMarcelo da Rocha
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughBradley Holt
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_companyGanesh Kulkarni
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKBrendan Lim
 
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
 
Getting up & running with zend framework
Getting up & running with zend frameworkGetting up & running with zend framework
Getting up & running with zend frameworkSaidur Rahman
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend FrameworkJuan Antonio
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 
Performance tuning with zend framework
Performance tuning with zend frameworkPerformance tuning with zend framework
Performance tuning with zend frameworkAlan Seiden
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin GeneratorJohn Cleveley
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-startedtutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-startedtutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-startedtutorialsruby
 

Similar to Zend framework (20)

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
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-framework
 
Introduction to Zend Framework
Introduction to Zend FrameworkIntroduction to Zend Framework
Introduction to Zend Framework
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-framework
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_company
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
2007 Zend Con Mvc
2007 Zend Con Mvc2007 Zend Con Mvc
2007 Zend Con Mvc
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDK
 
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...
 
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
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
Performance tuning with zend framework
Performance tuning with zend frameworkPerformance tuning with zend framework
Performance tuning with zend framework
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 

Recently uploaded

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Recently uploaded (20)

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

Zend framework

  • 1.
  • 2. Intro • A web application framework written in PHP5 • Loosely coupled set of modules that perform various Tasks ‣ Database access (Zend_DB) ‣ Google Data API‟s (Zend_Gdata) • Easy to implement MVC model
  • 3. What is MVC? • MVC stands for Model-View-Controller ‣ Code is divided into three distinct groups • Model -- Internal representation of data, interface to backend storage (i.e. database), and “business logic” • View -- Code that represents the application‟s UI • Controller -- Code that generates output to populate the view using the model
  • 4. •Download latest zend frame work •It contains two folders “bin” and “library". Copy that to wamp/bin/php/=>newfolder say zend_frame. •Change the include_path for windows in php.ini to wamp/bin/php/zend_frame/library Now zend is installed… to check zend is installed or not --------------- Take cmd prompt and-> type zf show version If its displaying the correct version, Your Zend is functioning
  • 5. Take cmd => go to your local host folder here its wamp/www/ Type=> zf create project Zendy projectname Your project is created….you can check in the www folder…. Also copy the folder zend in the library to this project`s library
  • 7. • application/Bootstrap.php ‣ Application bootstrap code • application/configs ‣ Configuration files • application/controllers ‣ Backend controller code • application/models ‣ Code mapping from domain data to storage data (PHP interface to DB for example) • application/views/scripts ‣ User interface code • application/configs/application.ini ‣ Main configuration file • application/controllers/ ‣ ErrorController.php -> Default controller called when an error occurs ‣ IndexController.php ->Default controller when no controller is specified
  • 8. You can go to your project by typing localhost/zendy/public on your browser Your project frontage will be like this:
  • 9. A controller that handles all requests for a Web site. Zend_Controller_Front implements a Front Controller pattern used in Model-View- Controller (MVC) applications. Its purpose is to initialize the request environment, route the incoming request, and then dispatch any discovered actions; it aggregates any responses and returns them when the process is complete.
  • 10. The index.php file is the entry point to our application and is used to create an instance of Zend_Application to initialise our application and then run it. This file also defines two constants: APPLICATION_PATH and APPLICATION_ENV which define the path to the application/ directory and the environment or mode of the application. The default is set to production in index.php, but you should set it to development in the .htaccess file by adding this line: SetEnv APPLICATION_ENV development
  • 12. Adding a New Action • When forms are submitted, there is some backend code that processes the input ‣ We will handle this in a new action within the Indexcontroller ‣ We use the „zf‟ tool to create the relevant code stubs zf create action actionname controllername Eg: zf create action about index • This creates the function aboutAction() in application/controllers/IndexController.php class IndexController extends Zend_Controller_Action { public function addAction() { /* Initialize action controller here */ }
  • 13. EXAMPLE FOR ZEND Page Controller Action Home page Index index Add new album Index add Edit album Index edit Delete album Index delete And the data fields are id(auto increment) ,artist and album
  • 14. Actions zf create action add Index zf create action edit Index zf create action delete Index The URLs for each action are: http://localhost/zf-tutorial/public/ IndexController::indexAction() http://localhost/zf-tutorial/public/index/add IndexController::addAction() http://localhost/zf-tutorial/public/index/edit IndexController::editAction() http://localhost/zf-tutorial/public/index/delete IndexController::deleteAction() class IndexController extends Zend_Controller_Action { public function addAction() { /* Initialize action controller here*/ }
  • 15. Database configuration Open application/configs/application.ini and add the following to the end of the [production] section (i.e. above the [staging] section): resources.db.adapter = “PDO_MYSQL” resources.db.params.host = “localhost” resources.db.params.username = “root” resources.db.params.password = “” resources.db.params.dbname = “zend”
  • 16. Create the database table CREATE TABLE albums (id int(11) NOT NULL auto_increment,artist varchar(100) NOT NULL,title varchar(100) NOT NULL,PRIMARY KEY (id)); Inserting test data INSERT INTO albums (artist, title) VALUES ('Paolo Nutine', 'Sunny Side Up„), ('Florence + The Machine', 'Lungs'), ('Massive Attack', 'Heligoland'), ('Andre Rieu', 'Forever Vienna'), ('Sade', 'Soldier of Love');
  • 17. The MODEL Zend Framework provides Zend_Db_Table which implements the Table Data Gateway design pattern to allow for interfacing with data in a database table. For this tutorial, we are going to create a model that extends Zend_Db_Table and uses Zend_Db_Table_Row. zf create db-table Albums albums <?php class Application_Model_DbTable_Albums extends Zend_Db_Table_Abstract { protected $_name = 'albums'; } ?>
  • 18.
  • 19.
  • 20. Layouts and views Zend_Layout allows us to move all the common header, footer and other code to a layout view script which then includes the specific view code for the action being executed. Zf enable layout Zendy/application/layouts/scripts/layout.phtml To get the view script for the current action to display, we echo out the content placeholder using the layout() view helper: echo $this->layout()->content; which does the work for us.
  • 21. We need to set the doctype for the webpage before we render any view scripts. As the action view scripts are rendered earlier and may need to know which doctype is in force. This is especially true for Zend_Form. To set the doctype we add another line to our application.ini, in the [production] section: resources.view.doctype = "XHTML1_STRICT“ resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" The doctype() view helper will now output the correct doctype and components like Zend_Form willgenerate compatible HTML.
  • 22. Styling Styling is done by making css file in ZENDY/public/css/site.css And then include that file inside the layout <?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/site.css'); ?> By using headLink()‟s prependStylesheet() method, we allow for additional, more specific, CSS files to be added within the controller view scripts which will be rendered within the <head> section after site.css
  • 23. To display all the dats in the index page….. zf-tutorial/application/controllers/IndexController.php ... function indexAction() { $albums = new Application_Model_DbTable_Albums(); $this->view->albums = $albums->fetchAll(); } … zf-tutorial/application/views/scripts/index/index.phtml <?php foreach($this->albums as $album) : ?> <td><?php echo $this->escape($album->title);?></td> <td><?php echo $this->escape($album->artist);?></td> <a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'edit', 'id'=>$album->id));?>">Edit</a> <a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'delete', 'id'=>$album->id));?>">Delete</a> <?php endforeach; ?>
  • 24.
  • 25. Adding new albums There are two bits to this part: • Display a form for user to provide details • Process the form submission and store to database zf create form Album This creates the file Album.php in application/forms
  • 27. <?php ADD action $this->title = "Add new album"; $this->headTitle($this->title) ;echo $this->form ; ?>
  • 29. zf-tutorial/application/views/scripts/index/edit.phtml <?php $this->title = "Edit album"; $this->headTitle($this->title); echo $this->form ; ?> DELETE ACTION
  • 31. This concludes our brief look at building a simple, but fully functional, MVC application using Zend Framework. •Zend framework is loosely packed ,but more secure