I wanted to create a simple Joomla 3.x plugin to show HTML on every page including the administration pages. It was extremely difficult to find any sample online as I did not know the what to look for. Here is a very quick tutorial on how to show “Hello World” on each and every Joomla page including administration pages.
JOOMLA_ROOT is the root folder where Joomla is installed.
Quick Hint: We are going to create system plugin (system = a type of plugin group that runs for every page, plugin = a type of Joomla extension).
Plugin Name: PramukhIME
Bold named folder/file must exist in order for the plugin to function.
- Create a folder JOOMLA_ROOT/plugins/system/pramukhime (Why here? because it is a system plugin called PramukhIME)
- Create a file JOOMLA_ROOT/plugins/system/pramukhime/pramukhime.xml and put the following code in it
<?xml version="1.0" encoding="utf-8"?> <extension version="3.1" type="plugin" group="system" method="upgrade"> <!-- This name tag is a user friendly name and you can name it the way you want. --> <name>PramukhIME</name> <author>Vishal Monpara</author> <creationDate>October, 2017</creationDate> <copyright>Copyright (C) 2017 Vishal Monpara. All rights reserved.</copyright> <license>see license.html</license> <authorEmail>email@example.com</authorEmail> <authorUrl>www.vishalon.net</authorUrl> <version>1.0.0</version> <files> <!-- plugin tag value must be plugin name and the php file must be the pluginname.php --> <filename plugin="pramukhime">pramukhime.php</filename> </files> </extension>
- Create a file JOOMLA_ROOT/plugins/system/pramukhime/pramukhime.php and write following code in it
That’s it. You have made your first system plugin.
- Login to the Joomla Administration
- Go to Extensions (top menu) > Manage > Discover
- It will list the plugin as plg_system_pramukhime
- Select the checkbox for this plugin and click “Install” on the top left corner.
- So far the plugin is installed but yet to be enabled.
- Go to Extensions > Plugins
- Search for pramukhime and it will show plg_system_pramukhime
- Click on the box under “Status” to enable the plugin
- As soon as you enable it, you will see Hello World in the bottom.
- Go to the front page and you will also see Hello World in the bottom.