How to get rid of the module ID |
04/17/2007 |
In developing modules for
Joomla!, it happens sometimes that you need know the ID or the title of the
module you are working with. Knowing the
ID of a specific module can be useful if you ever need to recover information
that is file dependent. You can do this with the standard function most people
use: $params->get (my parameter)
This function makes it
possible to obtain the personalized parameters of the module.
To apply this code to the diagram $params->get (id) or
$params->get (title) will thus not function since the function get
is an instruction of the class mosParameters and applies only to
information of parameters, it only makes it possible to convert in
table/object the variables recorded in the form mavariable=mavalor
separated by returns to the line.
To obtain information of the module it is necessary to turn to the
function mosLoadModule and the various variables used. In returned the
HTML of the module, one finds in parameters of the function in
particular, the variables $module, $params and $Itemid.
It is thus in the variable $module that we will find our happiness
because the latter stock all information which we need. It is made up
of the fields id, module, position, content, showtitle and params.
In your development of module it is enough for you just to make the call in the form $module->id or $module->title and the turn is played!
|