25 Aug 2016

Using the modules "Note" parameter

The Note field of a Joomla module is intended to display some comment for admin use in the back end, but it's such a handy parameter that it would be a real shame to just waste it on the back end.

One handy use I have for the note field is to use it to display some information on the front end, essentially turning it into a custom field. I quite commonly use it to create a button, using the note field to store the URL link, although it can for virtually any purpose.

The following is an example of how it can be incorporated into the module template file:

<?php

$menuitemid = JRequest::getInt('Itemid');
$db =& JFactory::getDBO();
$query = "SELECT note FROM #__modules WHERE id = '".$module->id."' ";
$db->setQuery($query);
$note = $db->loadResult();

echo $note;
?>