Some general thoughtsWeb services. Integrated JSON support and transparentauthentication, opening the door for data provisioning to apps (web,desktop, mobile,...)Almost RESTful, not entirelyHMVC components right here, right now, without having torelearn Joomla! component development, i.e. the exact opposite of theproposed Joomla! Framework, whenever that’s ready.
StructureDispatcherControllerModel ViewToolbarHelpers“triad”TableThe Dispatcher is the entry point (a.k.a. “router”). It will setup,run and render the MVC triad.The Controller is a thin interface to push data to the model stateand instantiate viewsThe Model is the workhorse. Business logic goes here.The Table class is a hybrid data adapter, controller and model(following J!s convention)The View fetches model state data and renders them in ameaningful wayThe Toolbar handles the rendering of titles, buttons and so onNon-OOP stuff. Basically, a nice way to say “cruft”
Convention over configuration inthe DispatcherThe Dispatcher is your component’s router. It routes the request tothe appropriate Controller based on conventions:A POST request gets routed to the save taskA GET request to a plural view name gets routed to the browsetaskA front-end GET request with an ID gets routed to the read taskA back-end GET request with an ID gets routed to the edit task
Convention over configuration inModelsTables are named as #__component_view, e.g. #__todo_itemsAuto increment field is named component_view_id, e.g.todo_item_idMagic fields: enabled, created_by, created_on, modified_by,modified_on, locked_by, locked_on, hitsYou can override defaults without copying & pasting code, ever.Copy & paste is the devil!
Convention over configuration inControllersDefault tasks (not RESTful!): browse, read, edit, add, delete, save,apply, ...Customize with onBeforeMethod and onAfterMethod methods, e.g.onBeforeSave. Dont copy & paste code.All MVC objects can be passed a $config array to customize them. It"flows" from dispatcher to component to model and view.FOF guesses the task if its missing based on plural/singular viewname and existence of ID in the query
Convention over configuration inViewsViews inherit from FOFView and its specialized children, e.g.FOFViewHtmlCustomize using the onTask methods, e.g. onBrowseThe toolbar is handled outside the view, in a FOFToolbar descendantclass. Override it with a toolbar.php file in the components root.Magic toolbar methods, e.g. onItemsBrowse allow you to customizethe toolbar without copying & pasting code.
HMVC – Hierarchical MVCInclude the results of component views anywhere (other views, othercomponent, modules, ...)FOFDispatcher::getTmpInstance(‘com_foobar’, ‘items’, array(‘layout’=> ‘fancy’))->dispatch();
Reuse view templatesLoad a view template from another view, component, ...echo $this->loadAnyTemplate(site:com_foobar/item/form);
Media files overridesLoad media files like this:FOFTemplateUtils::addCSS(media://com_foobar/css/frontend.css);Media overrides are inside the template folder, e.g.templates/tpl_example/media/com_foobar/css/frontend.css
Web services & automatic JSONand CSV viewsJust add format=json or format=csvJSON: You have an instant JSON-based remote API for yourcomponentsCSV: You can quickly export whatever you see in the backend toExcel, Numbers, LibreOffice, Google Docs, etc.Transparent authentication support using URL parameters or HTTPBasic Authentication
XML-based viewsIt’s JForm on double dose of steroidsBrowse, read and edit views from XML templatesYou don’t need to write any PHP or HTML, but you can mixtraditional PHP-based and XML-based templates, even in the sameviewOverridable with Joomla! template overridesYou can write components with virtually no PHP code at all