Joomla Day India 2009 Business Logic With The Mvc

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.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    Joomla Day India 2009 Business Logic With The Mvc - Presentation Transcript

    1. Building Custom Components in Joomla 1.5
    2. Introduction
        • Toby Patterson
        • Executive Director of GMITC
        • http://www.gmitc.biz
    3. Purpose
        • Explain how to implement your business logic using a custom Joomla! component;
        • Introduce to the Joomla MVC and other system resources;
        • Demonstrate some code.
        • The purpose of this presentation is to:
    4. Do you need an extension?
        • How many people ... ?
        • Already have Joomla Websites?
        • Use Joomla 3PD extensions?
        • Want an extension that doesn't ( yet ) exist?
        • Are developers, have developers, or will hire developers to create an extension?
    5. What is an extension?
        • A Joomla! Extension ...
        • Implements your business logic,
        • Does not alter the Joomla core, so that you can easily perform upgrades,
        • Should ( but does not have to ) use the Joomla Framework.
    6. Why Write an Extension
      • You may wish to write an extension if you have specific business logic that an existing extension does not perform or does not perform the task as you need.
    7. Examples of Extension Tasks
      • Displaying customer information.
      • Placing an order
      • Entering information about a person
      • Checking the status of an application
      • Changing a client's request
      • Sending a notification
      • many more ... ( this is where I ask for suggestions )
    8. Extensions in the Joomla Framework
        • Components - Interactive screens representing business logic.
        • Modules - Displayed in specific areas of a template.
        • Plugins - Extend the Joomla Framework.
        • It is easy to implement business logic using custom extensions.
    9. Joomla 1.5's MVC
      • Model-View-Controller
      • Software Design Pattern
      • Business, presentation, and control logic are separate
      • You can change one part without affecting another ( yay ! )
      • Joomla 1.5 is the first version of Joomla that uses a MVC design pattern ( double yay ! )
    10. What is an MVC
      • Model - The model is the part of the component that encapsulates the application’s data and business logic – it does the work.
      • View - The view is the part of the component that is used to render the data from the model using a layout file – it creates the interface.
      • Controller - The controller will determine what request has been made by the user and respond appropriately using the model and view – it controls who does what and when.
    11. Just Remember
      • Just remember:
      • Components implement custom business logic rules.
      • You may need to write your own component to express business logic specific to you.
      • Joomla 1.5 provides an MVC to help you write a component.
    12. Implementing the Simplest Component 1. Create the directory JOOMLA/components/com_hello/ 2. Create the file JOOMLA/components/com_hello/hello.php 3. Add the following code to the file <?php echo 'Hello World' ?> 4. Execute the following SQL query insert into jos_components values ( NULL, 'Hello', '', 0, 0, '', '', 'com_hello', 0, '', 0, '', 1 ); 5. Access the page using the following URL index.php?option=com_hello
    13. New to the MVC?
      • The Joomla Dev Website offers a sample hello component that you can experiment with.
    14. File System Layout
      • Files that you will see in the hello tutorial once installed.
      http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,tutorials:components/
    15. Typical Flow of Execution Determine what the user wants to do. Prepare the response. Perform the business logic. Display the results. Controller View Model Layout
    16. What Does a Model Look Like
      • Class that extends Joomla's JModel
      • Your method representing business logic
      model.php
    17. View from the Frontend
      • index.php?option=com_hello
    18. Modification to the View
      • Add code to fetch a specific greeting.
      hello.php
    19. View from the Frontend 2
      • index.php?option=com_hello&id=2
      Our presentation logic has not changed.
    20. Quick Review
      • So far we've learned that:
      • A component typically consists of a model, view, and controller;
      • A component should, but does not have to, use the MVC; and
      • Joomla offers an API for many common resources, such as the database and request variables.
    21. Displaying Data
      • We still need to display the data. That is where the views and the layout files come in.
      • Generally speaking, models are accessed from the view class, not the layout files, but either style works.
    22. Accessing the Business Logic
      • The method getGreeting() is called from the view class.
      view.html.php
    23. Modifying the Presentation Logic
      • The view contains the logic for displaying the data.
    24. Layout Files
      • Layout files are used to display the data. Your template files should be the few that contain HTML.
      nogreeting.php default.php
    25. Quick Review
      • Now we know that:
      • Models represent business logic;
      • Views represent presentation logic;
      • Layouts are for markup language.
    26. Controller tasks
      • You may not need to customize your controller because Joomla provides most of the control logic for you. However you can define your own methods if you want.
      • You may want to throw an error if the use is not logged in.
    27. Customizing the Controller controller.php
    28. Using Controller Methods
      • index.php?option=com_hello&task=showGreeting
    29. Abstract Programming Interface
      • Important APIs that we've seen.
      • MVC - JController, JModel, JView
      • Language - JText
      • Input - JRequest
      • User - JUser
      • Other Factory Resources
      • JFactory - Source for “global” objects
      • JApplication - The current application
      • JMail - Mailer object
      • JSession - Information about the current session
    30. Conclusion
      • The important concepts to take away are:
      • Controllers represent control logic;
      • Models represent business logic;
      • Views represent presentation logic;
      • Layouts are for markup language.
      • Joomla 1.5 provides new facilities for you to easily represent your business logic using a custom component.

    + teamphpteamphp, 6 months ago

    custom

    699 views, 1 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 699
      • 699 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 19
    Most viewed embeds

    more

    All embeds

    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