Reputation: 236
Is it possible to render a module in joomla without the head and/or other unrelevant elements, just the specific code related to a specific module?
I have a series of modules assigned to custom positions, what I'm trying to achieve is to load the modules via ajax when the user hovers a link and display it inside a div, then when the user moves to another link the div will get emptied and a new module will get loaded; so far I can render the modules, the problem is that when the module is rendered using JModuleHelper::renderModule, it will also render the article area, menus and tons of scripts and elements that are not relevant.
Upvotes: 0
Views: 448
Reputation: 2012
You can create your own module layout. To do this, you need to crate modules.php file in your template folder (templates/YOUR_TEMPLATE/html/modules.php). Heres sample code of modules.php (let's name the layout "blank"):
<?php
defined('_JEXEC') or die;
function modChrome_blank($module, &$params, &$attribs)
{
if (!empty ($module->content))
echo $module->content; ?>
}
?>
Then, when defining your module position in template's index.php file you can assign layout like this:
<jdoc:include type="modules" name="POSITION-NAME" style="blank" />
Upvotes: 1