Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013

  • 2,428 views
Uploaded on

This is an introduction to plugin and module extension development for Joomla 3. It was presented at Sydney JUG in April 2013, and was accompanied with some live demos of a simple content plugin and …

This is an introduction to plugin and module extension development for Joomla 3. It was presented at Sydney JUG in April 2013, and was accompanied with some live demos of a simple content plugin and simple module. If you want the source code from the live demos, feel free to get in touch with me.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,428
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
77
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Joomla Plugin & Module Develpment Tim Plummer http://twitter.com/bfsurveyPresented at Sydney JUG 09/04/2013
  • 2. What is a plugin?
  • 3. What is a module?
  • 4. Tools you need • Web Server & PHP & MySQL (XAMPP) • Text editor or IDE (Textpad / Notepad++ or Eclipse / Netbeans) • Web browser (Firefox with firebug)
  • 5. Getting started with plugins• Can be as simple as two files – yourplugin.xml – yourplugin.php• Located in /plugins/plugintype/yourplugin• Triggered by events
  • 6. Installation XML (aka manifest) • yourplugin.xml file located in your plugin folder • Used when installing your plugin – tells Joomla all the files used, and the type of plugin it is. • Contains information about the plugin, such as it’s name, author, version number etc. • Has all the parameters (aka options)
  • 7. Entry point• yourplugin.php file located in your plugin folder• This code is executed when the plugin runs, and can call other files.• Does all the hard work
  • 8. Types of plugins• Authentication • Quick Icon• Captcha • Search• Content • Smart Search (finder)• Editors • User• Editors-XTD • System• Extension
  • 9. Plugin Event Triggers• Authentication • Content – onUserAuthenticate – onContentAfterDelete – onUserAuthorisationFail – onContentAfterDisplay ure – onContentAfterSave• Captcha – onContentAfterTitle – onCheckAnswer – onContentBeforeDelete – onDisplay – onContentBeforeDisplay – onInit – onContentBeforeSave – onContentChangeState – onContentPrepare – onContentPrepareData – onContentPrepareForm – onContentSearch – onContentSearchAreas
  • 10. Plugin Event Triggers…cont• Editors • Extension – onDisplay – onExtensionAfterInstall – onGetContent – onExtensionAfterSave – onGetInsertMethod – onExtensionAfterUninstall – onInit – onExtensionAfterUpdate – onSave – onExtensionBeforeInstall – onSetContent – onExtensionBeforeSave• Editors-XTD – onDisplay – onExtensionBeforeUninstall – onExtensionBeforeUpdate
  • 11. Plugin Event Triggers…cont• Quick Icon • System – onGetIcons – onAfterDispatch• Search – onAfterInitialise – onAfterRender – onContentSearchAreas – onAfterRoute – onContentSearch • User• Smart Search – onUserAfterDelete – onFinderAfterDelete – onUserAfterSave – onFinderAfterSave – onUserBeforeDelete – onFinderBeforeSave – onUserBeforeSave – onFinderCategoryChangeState – onUserLogin – onFinderChangeState – onUserLogout
  • 12. plg_content_joomlarocks• Hello World sucks, so instead tonight we are going to create a plugin called plg_content_joomlarocks• This plugin will find all the “Joomla!” text in articles and replace it with “Joomla Rocks” and turn this into a link that goes to www.joomla.org
  • 13. Set Error Reporting to Maximum
  • 14. Demo time…
  • 15. Getting Started with modules• Slightly more complex than plugins, but still way simpler than components.• Can be as little as three files (but usually 4+) – mod_yourmodule.xml – mod_yourmodule.php – helper.php – /tmpl/default.php
  • 16. Types of modules• Two types – Frontend Module (aka site) • /modules/yourmodule – Backend Module (aka administrator) • /administrator/modules/yourmodule
  • 17. Installation XML (aka manifest)• mod_yourmodule.xml file located in your module folder• Used when installing your module – tells Joomla all the files used, and the type of module it is.• Contains information about the module, such as it’s name, author, version number etc.• Has all the parameters (aka options)
  • 18. Entry Point• mod_yourmodule.php file located in your module folder• This code is executed when the plugin runs, and can call other files.• Is lazy and makes the helper and view do all the work.
  • 19. Helper• helper.php file located in module folder• Talks to the database and prepares data for the view.
  • 20. The View• Located in /tmpl/default.php in the module folder• Presents the data to the user• Doesn’t know where the data came from or how it is stored and doesn’t care (as Sargent Schultz would say, I know nothing!).
  • 21. mod_random_article• Tonight we are going to create an article mod_random_article• This will randomly select an article and show the title with a link.
  • 22. Demo time…
  • 23. Now you are ready to start creating your own plugins and modules
  • 24. Questions?
  • 25. Tim Plummer @bfsurveytim@tamlyncreative.com.au