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.
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
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
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
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.