Joomla Complex Component MVC Proposal
-
Upload
julio-pontes -
Category
News & Politics
-
view
3.045 -
download
1
description
Transcript of Joomla Complex Component MVC Proposal
Joomla! Component Complexity
@juliopontes
What’s best for
depends on
situation
you
your
complexity
Plugin
Module
Component
ModularComponent
It depends onthe problem
you need to solve
Joomla!
architectureapplication
Site Application
Components
ControllersHelpers Models
Views
ControllersHelpers Models
Views
ControllersHelpers Models
Views
Component name Component name 2 component name 3
All components work together to build our site.
default
architecturecomponent
Component
Controllers Helpers Models Views
but for a complex component how does it work?
Lets think on a ecommerce component
ecommerce
functionalitiescomponent
software
Catalog
Sales
Promotions
Customers
Reports …
How to start?
ecommerce
functionalitiescomponent
software
Catalog
Products
Categories
Attributes
Attributes Sets
Tags
Customers
Manage Customers
Customers Groups
Promotions …
1. Separate your functionalities2. List functionalities by “group”
ecommerce
functionalitiescomponent
software
Ecommerce software
Sales Component
CustomersComponent
…
ecommerce
functionalities
Sales
Catalog
Customers
Promotion
Reports
System
Sale
s
Orders
Invoices
Shipments
Credit Memos
Transactions
Billing Agreements
Terms and Conditions
Tax
componentsoftware
ecommerce
functionalities
Sales
Catalog
Customers
Promotion
Reports
System
Cata
log
Products
Categories
Attributes
Attributes Sets
Tags
componentsoftware
modular
architecturecomponent
Component
Component modules (folder)
ControllersHelpers Models
Views
ControllersHelpers Models
Views
ControllersHelpers Models
Views
Module name Module name 2 Module name 3
All components modules work together and build our component.
Understand
URLModular component
index.php?option=com_ecommerce&module=catalog&task=controller.task
component Component module Task
understand
getInstanceJcontroller(Legacy)
JController::getInstance(‘BASE_NAME’);
1. Will search controller.php file in a base_path2. If not defined base_path will assume JPATH_COMPONENT3. Your master controller name should be “BASE_NAME” + “Controller”
Examples
getInstanceJcontroller(Legacy)
JController::getInstance(‘Content’);JController::getInstance(‘Users’);JController::getInstance(‘Banners’);
ContentControllerUsersControllerBannersController
Master Controller NameInstantiations
com_contentcom_userscom_banners
Component
Understand
Bootstrap.phpModular component
- 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”
Understand
LogicModular component
index.php?option=com_ecommerce&module=catalog
ecommerce.php bootstrap.php config
module.php
folder
MODULE MODULE MODULE
Read config.include
Instantiate Controller
Pseudo Code
Bootstrap.phpModular component
JController::getInstance(‘EcommerceCatalog’, array(
‘base_path’ => JPATH_COMPONENT_MODULE)
);
index.php?option=com_ecommerce&module=catalog
Component = EcommerceModule = Catalog
File system
architectureDefault component
Attributes for Customers, Products ???
What relations between controllers ???How to start to understand???
Questions?!
File system
architectureModular component
File system
architectureModular component
Attributes for products
Tags for products
Products Management
Understand
Module file systemModular component
Master Controller
Views from Catalog Component Module
Tables from Catalog Component ModuleModels from Catalog Component Module
Helpers from Catalog Component Module
Sub Controllers from Catalog Component Mod.
Component Module Name
Repository of component modules
Code
StandardsModular component
Component + Module + “Controller” + Controller Name
Component + Module + “Helper”
Component + Module + “Model” + Model Name
Component + Module + “Table” + Table Name
Component + Module + “View” + View NameComponent + Module + “Controller”
Code
StandardsModular component
EcommerceCatalogControllerTags
EcommerceCatalogHelper
EcommerceCatalogModelTags
EcommerceCatalogTableTags
EcommerceCatalogViewTagsEcommerceCatalogController
THANK YOU!
http://www.github.com/juliopontes/ecommerce-modular-component
This 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.
Build your
ExampleModular component