Need code to check if module exists

What is the correct syntax to check to see if module exists in $doc->addHeadLink section of the following code:

Code:
[php]if ($params->get(‘opensearch’, 1))
{
$doc = JFactory::getDocument();

    $ostitle = $params->get('opensearch_title', JText::_('MOD_SEARCH_SEARCHBUTTON_TEXT') . ' ' . $app->get('sitename'));
    $doc->addHeadLink(
                    JUri::getInstance()->toString(array('scheme', 'host', 'port'))
                    . JRoute::_('&option=com_search&format=opensearch'), 'search', 'rel',
                    array(
                            'title' => htmlspecialchars($ostitle),
                            'type' => 'application/opensearchdescription+xml'
                    )
            );

}
[/php]

Thank you bunches in advance for any help anyone can provide.

Did you resolve this yet? I do not use Joomla, but…

I think you need to not use the document, but, the module-helper instead. It will check out the module and you can see if it located it or not. Here is a link explaining it. Hope this helps!

https://docs.joomla.org/JModuleHelper/getModule

Sponsor our Newsletter | Privacy Policy | Terms of Service