Determining if a specific module type is used on a page. - Joomla! Forum - community, help and support


i add php script template's index.php file test see if specific module/module type (mod_mainmenu) being used within specific layout position (user1) on page.

right now, have conditional script can test if there or isn't module being placed in user1 position,
but need modify test see if module module type of mod_mainmenu present.  testing specific module name (and not module type) work me too.

here's have far:


if (!moscountmodules('user1')  {
$variable = 0;
}
else {
  $variable = 1;
}

thanks!

does work you?

code: select all

$query = 'select count(id) #__modules module = "mod_mainmenu" , position = "user1"';
$database->setquery($query);
$result = $database->loadresult();

if ( $result ) {
 do someting
} else {
 do else
}


in case $result should either 0 or 1





Comments