SlideShare une entreprise Scribd logo
1  sur  21
Framework on
Framework (FOF)
Rapid component development
What is FOF?
Or, rather, what's 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 - Don't 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)
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)
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
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!
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. Don't 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 it's missing based on plural/
 singular view name and existence of ID in the query
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 component's root.

• Magic toolbar methods, e.g. onItemsBrowse allow you
 to customize the toolbar without copying & pasting
 code.
HMVC


• Include the results of component views anywhere
 (other views, other component, modules, ...)

• FOFDispatcher::getTmpInstance(‘com_foobar’,
 ‘items’, array(‘layout’ => ‘fancy’))->dispatch();
Reuse view templates


• Load a view template from another view,
 component, ...

• echo $this->loadAnyTemplate('site:com_foobar/
 item/form');
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
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
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.
FOF Resources
 http://akeeba.info/fof
You ask, I reply
The End
is the beginning

Contenu connexe

Tendances

ALPHA Script - XML Generator
ALPHA Script - XML GeneratorALPHA Script - XML Generator
ALPHA Script - XML Generator
PROBOTEK
 

Tendances (6)

Custom Fields in Joomla - JoomlaDay UK 2016 - Marco Dings
Custom Fields in Joomla - JoomlaDay UK 2016 - Marco DingsCustom Fields in Joomla - JoomlaDay UK 2016 - Marco Dings
Custom Fields in Joomla - JoomlaDay UK 2016 - Marco Dings
 
Oracle Forms- key triggers
Oracle Forms- key triggersOracle Forms- key triggers
Oracle Forms- key triggers
 
wp-n00b.php
wp-n00b.phpwp-n00b.php
wp-n00b.php
 
Dev days Szeged 2014: Plugin system in drupal 8
Dev days Szeged 2014: Plugin system in drupal 8Dev days Szeged 2014: Plugin system in drupal 8
Dev days Szeged 2014: Plugin system in drupal 8
 
Develop Basic joomla! MVC component for version 3
Develop Basic joomla! MVC component for version 3Develop Basic joomla! MVC component for version 3
Develop Basic joomla! MVC component for version 3
 
ALPHA Script - XML Generator
ALPHA Script - XML GeneratorALPHA Script - XML Generator
ALPHA Script - XML Generator
 

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

Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjsCodemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Fabio Franzini
 
Joomla Day India 2009 Business Logic With The Mvc
Joomla Day India 2009   Business Logic With The MvcJoomla Day India 2009   Business Logic With The Mvc
Joomla Day India 2009 Business Logic With The Mvc
Amit Kumar Singh
 
symfony_from_scratch
symfony_from_scratchsymfony_from_scratch
symfony_from_scratch
tutorialsruby
 
symfony_from_scratch
symfony_from_scratchsymfony_from_scratch
symfony_from_scratch
tutorialsruby
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austin
Chad Windnagle
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
Nerd Tzanetopoulos
 

Similaire à FOF Rapid Application Development on Joomla! - Joomla! Day Denmark 2012 (20)

Rapid application development with FOF
Rapid application development with FOFRapid application development with FOF
Rapid application development with FOF
 
Presentation 1 Web--dev
Presentation 1 Web--devPresentation 1 Web--dev
Presentation 1 Web--dev
 
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjsCodemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
 
Advance Component Development by Azrul Rahim
Advance Component Development by Azrul RahimAdvance Component Development by Azrul Rahim
Advance Component Development by Azrul Rahim
 
Joomla Day India 2009 Business Logic With The Mvc
Joomla Day India 2009   Business Logic With The MvcJoomla Day India 2009   Business Logic With The Mvc
Joomla Day India 2009 Business Logic With The Mvc
 
Tell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature FlagsTell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature Flags
 
symfony_from_scratch
symfony_from_scratchsymfony_from_scratch
symfony_from_scratch
 
symfony_from_scratch
symfony_from_scratchsymfony_from_scratch
symfony_from_scratch
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPages
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austin
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVC
 
CUST-2 New Client Configuration & Extension Points in Share
CUST-2 New Client Configuration & Extension Points in ShareCUST-2 New Client Configuration & Extension Points in Share
CUST-2 New Client Configuration & Extension Points in Share
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
presentation
presentationpresentation
presentation
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
 
Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 

Plus de Nicholas Dionysopoulos

Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
Nicholas Dionysopoulos
 
Joomla! Day Poland 2012 - Monetize your site with Akeeba Subscriptions
Joomla! Day Poland 2012 - Monetize your site with Akeeba SubscriptionsJoomla! Day Poland 2012 - Monetize your site with Akeeba Subscriptions
Joomla! Day Poland 2012 - Monetize your site with Akeeba Subscriptions
Nicholas Dionysopoulos
 
Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...
Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...
Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...
Nicholas Dionysopoulos
 
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sitesJoomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Nicholas Dionysopoulos
 

Plus de Nicholas Dionysopoulos (10)

Hidden in plain site – joomla! hidden secrets for code monkeys
Hidden in plain site – joomla! hidden secrets for code monkeysHidden in plain site – joomla! hidden secrets for code monkeys
Hidden in plain site – joomla! hidden secrets for code monkeys
 
Joomla! Security 101 - Joomla! Day Bosnia and Herzegovina 2013
Joomla! Security 101 - Joomla! Day Bosnia and Herzegovina 2013Joomla! Security 101 - Joomla! Day Bosnia and Herzegovina 2013
Joomla! Security 101 - Joomla! Day Bosnia and Herzegovina 2013
 
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
 
JWC - Rapid application development with FOF
JWC - Rapid application development with FOFJWC - Rapid application development with FOF
JWC - Rapid application development with FOF
 
Advanced Akeeba Backup (Joomla! Day Denmark 2012)
Advanced Akeeba Backup (Joomla! Day Denmark 2012)Advanced Akeeba Backup (Joomla! Day Denmark 2012)
Advanced Akeeba Backup (Joomla! Day Denmark 2012)
 
Joomla! Day Deutschland 2012 - Advanced Akeeba Backup
Joomla! Day Deutschland 2012 - Advanced Akeeba BackupJoomla! Day Deutschland 2012 - Advanced Akeeba Backup
Joomla! Day Deutschland 2012 - Advanced Akeeba Backup
 
Joomla! Day Deutschland 2012 - Active Security
Joomla! Day Deutschland 2012 - Active SecurityJoomla! Day Deutschland 2012 - Active Security
Joomla! Day Deutschland 2012 - Active Security
 
Joomla! Day Poland 2012 - Monetize your site with Akeeba Subscriptions
Joomla! Day Poland 2012 - Monetize your site with Akeeba SubscriptionsJoomla! Day Poland 2012 - Monetize your site with Akeeba Subscriptions
Joomla! Day Poland 2012 - Monetize your site with Akeeba Subscriptions
 
Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...
Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...
Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...
 
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sitesJoomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sites
 

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

  • 1. Framework on Framework (FOF) Rapid component development
  • 2. What is FOF? Or, rather, what's it not?
  • 3. Not a fork of another framework (or trying to sell you a fork of your favourite CMS...)
  • 4. Not the best thing since sliced bread
  • 5. Not A Real Framework (NARF)
  • 6. FOF extends the Joomla! MVC API It does not replace or undermine it
  • 7. FOF is licensed under GNU/GPL Note: it’s GPL version 3 or later
  • 8. Design goals • DRY - Don't 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. 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. 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. 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. 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. Don't 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 it's missing based on plural/ singular view name and existence of ID in the query
  • 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 component's root. • Magic toolbar methods, e.g. onItemsBrowse allow you to customize the toolbar without copying & pasting code.
  • 14. HMVC • Include the results of component views anywhere (other views, other component, modules, ...) • FOFDispatcher::getTmpInstance(‘com_foobar’, ‘items’, array(‘layout’ => ‘fancy’))->dispatch();
  • 15. Reuse view templates • Load a view template from another view, component, ... • echo $this->loadAnyTemplate('site:com_foobar/ item/form');
  • 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. 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. 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.
  • 20. You ask, I reply
  • 21. The End is the beginning

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n