Framework onFramework (FOF)Rapid component development
What is FOF?Or, rather, whats it not?
Not a fork of another framework(or trying to sell you a fork of your favourite CMS...)
Not the best thing since sliced bread
Not A Real Framework        (NARF)
FOF extends the Joomla! MVC API     It does not replace or undermine it
FOF is licensed under GNU/GPL     Note: it’s GPL version 3 or later
Design goals• DRY - Dont Repeat Yourself. Copying & pasting code is  the source of all evil.• Write less, do more - less c...
Key features•   Convention over configuration, Rails style•   Use a query builder, even on Joomla! 1.5•   HMVC today, not ...
Overview of a component• The Dispatcher is the entry point. It will setup, run and render  the MVC view• The Controller is...
Convention over configuration in                 Models• Tables are named as #__component_view, e.g. #__todo_items• Auto i...
Convention over configuration in               Controllers• Default tasks (not RESTful!): browse, read, edit, add, delete,...
Convention over configuration in Views• Views inherit from FOFView and its specialized children, e.g. FOFViewHtml• Customi...
HMVC• Include the results of component views anywhere (other views, other component, modules, ...)• FOFDispatcher::getTmpI...
Reuse view templates• Load a view template from another view, component, ...• echo $this->loadAnyTemplate(site:com_foobar/...
Language loading and overrides• Automatically loads component language files (frontend and backend)• Hierarchical language...
Media files overrides• Load media files like this: FOFTemplateUtils::addCSS(media://com_foobar/ css/frontend.css);• Media ...
Automatic JSON and CSV views• Just add format=json or format=csv• JSON: You have an instant JSON-based remote API for your...
FOF Resources http://akeeba.info/fof
You ask, I reply
The Endis the beginning
Upcoming SlideShare
Loading in …5
×

FOF Rapid Application Development on Joomla! - Joomla! Day Denmark 2012

6,587 views

Published on

Presentation of FOF, rapid

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,587
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
43
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • FOF Rapid Application Development on Joomla! - Joomla! Day Denmark 2012

    1. 1. Framework onFramework (FOF)Rapid component development
    2. 2. What is FOF?Or, rather, whats it not?
    3. 3. Not a fork of another framework(or trying to sell you a fork of your favourite CMS...)
    4. 4. Not the best thing since sliced bread
    5. 5. Not A Real Framework (NARF)
    6. 6. FOF extends the Joomla! MVC API It does not replace or undermine it
    7. 7. FOF is licensed under GNU/GPL Note: it’s GPL version 3 or later
    8. 8. Design goals• DRY - Dont Repeat Yourself. Copying & pasting code is the source of all evil.• Write less, do more - less code, less failure points• It should never impose its own way of thinking. Gets out of your way when you want to work around it.• Backwards compatibility - no surprising, quantum changes every few days• Joomla! version abstraction (1.5, 2.5 and 3.0 supported)
    9. 9. Key features• Convention over configuration, Rails style• Use a query builder, even on Joomla! 1.5• HMVC today, not in 3 years, without relearning component development• Easy reuse of view template files without ugly include()• Automatic language loading and easy overrides• Media files override (works like template overrides)• Automatic JSON and CSV views with no extra code• Automatic Joomla! version template overrides (e.g. default.j30.php)
    10. 10. Overview of a component• The Dispatcher is the entry point. It will setup, run and render the MVC view• The Controller is a thin interface to push data to the model state and instantiate views• The 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 a meaningful way• The Toolbar handles the rendering of titles, buttons and so on
    11. 11. Convention over configuration in Models• Tables are named as #__component_view, e.g. #__todo_items• Auto increment field is named component_view_id, e.g. todo_item_id• Magic fields: enabled, created_by, created_on, modified_by, modified_on, locked_by, locked_on, hits• You can override defaults without copying & pasting code, ever. Copy & paste is the devil!
    12. 12. Convention over configuration in Controllers• Default 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 view name and existence of ID in the query
    13. 13. Convention over configuration in Views• Views inherit from FOFView and its specialized children, e.g. FOFViewHtml• Customize using the onTask methods, e.g. onBrowse• The toolbar is handled outside the view, in a FOFToolbar descendant class. Override it with a toolbar.php file in the components root.• Magic toolbar methods, e.g. onItemsBrowse allow you to customize the toolbar without copying & pasting code.
    14. 14. HMVC• Include the results of component views anywhere (other views, other component, modules, ...)• FOFDispatcher::getTmpInstance(‘com_foobar’, ‘items’, array(‘layout’ => ‘fancy’))->dispatch();
    15. 15. Reuse view templates• Load a view template from another view, component, ...• echo $this->loadAnyTemplate(site:com_foobar/ item/form);
    16. 16. Language loading and overrides• Automatically loads component language files (frontend and backend)• Hierarchical language overridding ‣ English loads first ‣ Current site/user language loads next and overrides English
    17. 17. Media files overrides• Load 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
    18. 18. Automatic JSON and CSV views• Just add format=json or format=csv• JSON: You have an instant JSON-based remote API for your components• CSV: You can quickly export whatever you see in the backend to Excel, Numbers, LibreOffice, Google Docs, etc.
    19. 19. FOF Resources http://akeeba.info/fof
    20. 20. You ask, I reply
    21. 21. The Endis the beginning

    ×