2

I'm attempting to show a module inside the com_content/article/default.php file but it fails. Here is the php code

<div class="mySearch">
<?php
     jimport( 'joomla.application.module.helper' );
     $module = JModuleHelper::getModule( 'finder' );
     $attribs['style'] = 'html';
     echo JModuleHelper::renderModule( $module, $attribs );  
  ?>
</div>

1 Answer 1

5

Assuming with fails you mean it simply doesn't show on the article page and not that you are getting any other kind of errors.

The code you posted seems okay and should work.

So, I guess it might be one of the following reasons:

  • Module is not enabled; - The module must be enabled.
  • Module is not assigned to the current menu item for that article. You may want to try to assign it to all pages/menu items till you will be able to see it being displayed.
  • Possibility that the module has special viewing access levels. You must have the needed access level to see the module.

Make sure those above conditions are met.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.