Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Php.Mvc Presentation

3,398 views

Published on

Php.Mvc Framework

Published in: Technology
  • Be the first to comment

Php.Mvc Presentation

  1. 1. Php.MVC <ul><ul><li>InfoStretch Solutions Pvt. Ltd </li></ul></ul><ul><ul><li>Prepared By </li></ul></ul>Niranjan Limbachiya Nimesh Chauhan
  2. 2. Overview <ul><li>Introduction </li></ul><ul><li>The Benefits </li></ul><ul><li>The MVC pattern Concepts </li></ul><ul><li>The Web-server Directory structure </li></ul><ul><li>Core components of Php.MVC Library </li></ul><ul><li>XML Application Configuration System </li></ul><ul><li>Controller </li></ul><ul><li>The Action Form & Action </li></ul><ul><li>Security </li></ul><ul><li>View </li></ul><ul><li>Resources </li></ul>
  3. 3. Introduction <ul><li>php.MVC is a M odel V iew C ontroller (MVC) framework for PHP Web applications </li></ul><ul><li>The use of this design philosophy makes it easier for designers and programmers to focus on their respective areas of expertise </li></ul><ul><li>This design model allows Web pages or other contents (Views) to be separated from the applications business logic, or code (Model) </li></ul><ul><li>php.MVC is a PHP port of the Jakarta Struts project. </li></ul>
  4. 4. Introduction
  5. 5. The Benefits <ul><li>php.MVC is a PHP port of the Jakarta Struts project </li></ul><ul><li>Enforces modularity and application partitioning </li></ul><ul><li>Increases developer/designer role separation </li></ul><ul><li>Increases code manageability </li></ul><ul><li>Increase code extensibility (Ability to adapt to change) </li></ul>
  6. 6. The MVC Pattern Concepts <ul><li>We can see the how a typical HTTP request from a Web client (Web browser) would interact with the core framework classes and our application classes, to produce a HTTP response (Web content) to return to the Web client. </li></ul>
  7. 7. Contd.. <ul><li>To start the process, a client would send our php.MVC application a request </li></ul><ul><ul><li>perhaps a request to view a particular company sales report </li></ul></ul><ul><ul><li>http://www.myhost.com/mycompany/Main.php?do=salesReport </li></ul></ul>
  8. 8. Web server Directory Structure
  9. 9. MVC Libraries <ul><li>.htaccess </li></ul><ul><ul><ul><li>control who can access this directory </li></ul></ul></ul><ul><li>art directory </li></ul><ul><ul><ul><li>Is used to hold the application graphics, and will be accessible to the Web </li></ul></ul></ul><ul><li>style directory </li></ul><ul><ul><ul><li>is used to hold the application style sheets and will also be accessible to the Web </li></ul></ul></ul><ul><li>/WEB-INF directory </li></ul><ul><ul><ul><li>This is where we locate the application classes and resources. </li></ul></ul></ul>
  10. 10. Contd.. <ul><li>The tpl directory </li></ul><ul><li>holds the applications View resources, such as page </li></ul><ul><li>ModulePaths.php file </li></ul><ul><ul><li>Is used to define the application specific paths to our classes and resources </li></ul></ul><ul><li>phpmvc-config.xml file </li></ul><ul><ul><li>Is the central component of the php.MVC application. </li></ul></ul><ul><li>phpmvc-config_1_1.dtd file </li></ul><ul><ul><li>Contains the Document Type Definitions (DTD) for the phpmvc-config.xml file </li></ul></ul><ul><li>prepend.php file is used to include application files </li></ul><ul><li>Main.php file </li></ul><ul><ul><li>is the single entry point for an application, and is located in the application root directory </li></ul></ul>
  11. 11. Core component of MVC <ul><li>The XML configuration file is the &quot;switchboard&quot; of a php.MVC application. This is how we bind the various components to a HTTP request path </li></ul><ul><li>The Controller consists of the php.MVC framework classes that are responsible for routing </li></ul><ul><li>HTTP requests to the correct Form and Action classes and View resources, as defined in the application phpmvc-config.xml file. </li></ul><ul><li>The Action Form classes can be used to handle Web form checks and validation </li></ul><ul><li>The Action classes are used to access our business classes. We can direct the application flow to resources based on run-time conditions </li></ul><ul><li>The Action Dispatcher class handles the resource (template) processing </li></ul>
  12. 12. XML Application configuration system
  13. 13. Example
  14. 14. Controller <ul><li>The Controller component of the php.MVC framework consists of classes that handle a users request according to predefined configuration options </li></ul><ul><li>A typical user request may look something </li></ul><ul><ul><li>Like: http://www.myhost.com/mycompany/Main.php?do=salesReport </li></ul></ul><ul><li>The php.MVC Controller consists of two distinct sections: </li></ul><ul><ul><li>The Front Controller </li></ul></ul><ul><ul><li>The Controller proper </li></ul></ul>
  15. 15. Front Controller
  16. 16. The controller
  17. 17. Action Form <ul><li>An ActionForm is represented in the XML Application Configuration like this: </li></ul><ul><li>The use of an ActionForm for a particular request path is optional, and can be activated in the XML Application Configuration System using the validate attribute of the action mapping node like this </li></ul>
  18. 18. Action <ul><li>An Action class is represented in the XML Application Configuration like this: </li></ul>
  19. 19. Security <ul><li>regular expression (RE) such as &quot;^[a-z0-9]{8}$&quot; </li></ul>
  20. 20. View <ul><li>Tpl comes into view </li></ul><ul><li>Action dispatcher </li></ul>
  21. 21. Resources <ul><li>www.phpmvc.net </li></ul><ul><li>php.MVC on SourceForge </li></ul>

×