Every Joomla Templates and Extensions developer has tricks to help himself to catch or analyze Variables, check how many Modules are on a given template position or catch User-Agent for any special behaviors you need. Normally I used to hard-code everything directly in the index.php of my Templates or later through an included files to have more cleanliness and order in the index. Last week I enjoy myself by writing a PlugIn that provides to attach at the end of <body> the same debugging lines.
How it works is very easy: it's a system PLG for Joomla and works through onAfterRender() Trigger Event of this CMS. The PlugIn gets and shows many useful Variables that we need to customize the output of CMS.
Of course, my PlugIn shows some Variables that I use for my projects (e.g.: Facebook Pixel Snippet, Modernizr, etc...), but if you don't need it, you can simply ignore them (You can also delete in the source code of PlugIn what you don't need, it is not an hard job!)
The PlugIn has few Parameters:
[1] A text field to set UserID of the Admin that have to see the Code-Lines, required (yes, it's only for one Admin... you!);
[2] A text field to set which Template position you need to monitor and count how many Module are active there;
[3] A color selector to set a more readable text on your template background color;
NOTE: you have to install the PlugIn, activate it and set your UserID in Params.
Then you MUST be logged in Front-End of your website or select Shared Session in CMS Global Configuration to see the Output.
Here below you can see a typical output of my PlugIn (depend to version):
=== CMS & Template Debugging =========
CMS Output Variables & Parameters
Option = com_content
View = featured
Layout = undefined
Page = undefined
Task = undefined
Menu ID = 101
Element ID (Art) =
Category ID = undefined
---------------------------
Language = it
Logged User ID = 70
---------------------------
Module Counter (pos: -set position-) = 0
---------------------------
Custom Params (for Digitest's templates)
Responsive Menu = 0
JQuery = 1
Bootstrap = 1
Mootools = 1
Test Messages = 0
Facebook Pixel = 1
---------------------------
USER Agent
Device Type = Desktop/PC
Platform = Windows
Browser = Mozilla Firefox
Version = 56.0
---------------------------
Common Extensions Status (Installed & Active)
OpenGraph = No
Page Title Extended = No
K Secure = No
Akeeba BKP = Yes
DMC Firewall = Yes
Brute Force Stop = No
---------------------------
System Data
Joomla Version = 3.9.23
PHP Version = 7.3.13
Plugin Version = 1.0.11
NOTE: the PlugIn uses Joomla Update System. If I change something about it you'll get the notify message in your admin area.
If you like to try (or improve) my PlugIn, you can download here below.
There is NO backlink, no ADV, no Logos... just PHP!
If you like to give me some feedbacks, please feel free to contact me!
Download latest PLG-Digitest-Debug ver. 1.0.11 (tested on Joomla > 3.9.X, PHP 7.3)
Download latest PLG-Digitest-Debug ver. 3.0.1 (tested on Joomla > 4.4, PHP >8.1)
Change Log
Ver 3.0.1: Update for PHP 8.1, Compatibility with Joomla 4.4
Ver 2.0.1: Compatibility with Joomla 3.9/4.0
Ver 1.0.11: Add new Mobile Detect PLG Extension Status;
Ver 1.0.10: Add some new Common and own Extensions Statuses;
Ver 1.0.9: Remove PHP Warning on explode() if not an Article;
Ver 1.0.8: Remove Modernizr Param, Add Responsive Menu Param (08 Jan 2020);
Ver 1.0.7: Update for PHP 7.3.X (29 May 2019);
Ver 1.0.6: Update for PHP 7.2.X (09 May 2019);
Ver 1.0.5: Multiple Admin IDs (28 Feb 2018);
Ver 1.0.4: Some improvements (09 Feb 2018);
Ver 1.0.3: MySQL issue by Add New Article (error: 1064) [SOLVED] (24 Oct 2017);
Ver 1.0.2: More parameters and new Responsive layout on two columns (20 Oct 2017);
Ver 1.0.1: Test version (18 Oct 2017);
Thanks, Fabrizio.