Joomla Complex Component MVC Proposal


Published on

Using JMVC in a different way.

This should work on 1.5 but need some changes.

Published in: News & Politics
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Joomla Complex Component MVC Proposal

  1. 1. Joomla! Component Complexity @juliopontes
  2. 2. What’s best for you depends on your situation
  3. 3. It depends on the problem you need to solve Modular Component Component Module Plugincomplexity
  4. 4. Joomla! application architecture Site Application Components Component name Component name 2 component name 3 Controllers Controllers ControllersHelpers Models Helpers Models Helpers Models Views Views Views All components work together to build our site.
  5. 5. default component architecture Component Controllers Helpers Models Viewsbut for a complex component how does it work? Lets think on a ecommerce component
  6. 6. software ecommerce component functionalitiesCatalog Promotions Sales Customers Reports … How to start?
  7. 7. ecommerce software component functionalities1. Separate your functionalities2. List functionalities by “group” Catalog Customers Promotions … Manage Products Customers Customers Categories Groups Attributes Attributes Sets Tags
  8. 8. ecommerce software component functionalities Customers Component Sales …Component Ecommerce software
  9. 9. ecommerce software component functionalities Orders Sales InvoicesSystem Catalog Shipments Sales Credit Memos Transactions BillingReports Customers Agreements Terms and Conditions Promotion Tax
  10. 10. ecommerce software component functionalities Sales ProductsSystem Catalog Categories Catalog AttributesReports Customers Attributes Sets Promotion Tags
  11. 11. modular component architecture Component Component modules (folder) Module name Module name 2 Module name 3 Controllers Controllers ControllersHelpers Models Helpers Models Helpers Models Views Views Views All components modules work together and build our component.
  12. 12. Understand Modular component URLindex.php?option=com_ecommerce&module=catalog&task=controller.task component Component module Task
  13. 13. understand Jcontroller(Legacy) getInstanceJController::getInstance(‘BASE_NAME’); 1. Will search controller.php file in a base_path 2. If not defined base_path will assume JPATH_COMPONENT 3. Your master controller name should be “BASE_NAME” + “Controller”
  14. 14. Examples Jcontroller(Legacy) getInstanceInstantiations Master Controller Name ComponentJController::getInstance(‘Content’); ContentController com_contentJController::getInstance(‘Users’); UsersController com_usersJController::getInstance(‘Banners’); BannersController com_banners
  15. 15. Understand Modular component Bootstrap.php- Read Configuration from config/module.php- Check if requested module are exists in folder structure- Define JPATH_COMPONENT_MODULE with module path- Define base_path as JPATH_COMPONENT_MODULE from JControllerLegacy- Use as base_name “COMPONENT” + “MODULE”
  16. 16. Understand Modular component Logicindex.php?option=com_ecommerce&module=catalog include Read config.ecommerce.php bootstrap.php config module.php Instantiate Controller folder MODULE MODULE MODULE
  17. 17. Pseudo Code Modular component Bootstrap.phpindex.php?option=com_ecommerce&module=catalogComponent = EcommerceModule = CatalogJController::getInstance( ‘EcommerceCatalog’, array( ‘base_path’ => JPATH_COMPONENT_MODULE ));
  18. 18. File system Default component architecture Attributes for Customers, Products ??? What relations between controllers ??? How to start to understand??? Questions?!
  19. 19. File system Modular component architecture
  20. 20. File system Modular component architecture Attributes for products Products Management Tags for products
  21. 21. Understand Modular component Module file system Repository of component modules Component Module Name Sub Controllers from Catalog Component Mod. Helpers from Catalog Component Module Models from Catalog Component Module Tables from Catalog Component Module Views from Catalog Component Module Master Controller
  22. 22. Code Modular component Standards Component + Module + “Controller” + Controller Name Component + Module + “Helper” Component + Module + “Model” + Model Name Component + Module + “Table” + Table Name Component + Module + “View” + View Name Component + Module + “Controller”
  23. 23. Code Modular component Standards EcommerceCatalogControllerTags EcommerceCatalogHelper EcommerceCatalogModelTags EcommerceCatalogTableTags EcommerceCatalogViewTags EcommerceCatalogController
  24. 24. Build your Modular component ExampleThis is a sample concept for development a complex software as a Joomla! component.I’ve not interesting on continue development of this example.The example its not fully implemented.It just for show a better way “thinking out of box” How to build complex components.If you use it, please feedback to community and share the solutions/problems thatyou’ve found by using this architecture. THANK YOU!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.