Return to Snippet

Revision: 53557
at November 28, 2011 11:02 by joomlabamboo


Initial Code
// Workaround to get the module id via the url. 
$moduleID = JUri::getInstance()->toString();
				
// Split the url instance so we can get the moduel id
$moduleID = split("=",$moduleID);
				
// The fourth = last variable in the module admin so we set the cookie name to that
$cookieName = "listOrder".$moduleID[4];

Initial URL

                                

Initial Description
It's not possible to use the standard syntax to retrieve the current id of the Joomla module in a Joomla xml element. This code parses the url and grabs the last part of the url which i atypically the module id when editing a module in the Joomla admin.

We used this to create a unique cookie for each instance of the module.

Initial Title
Retrieve module id in Joomla xml element

Initial Tags
joomla

Initial Language
PHP