0
votes

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.

1
For creating your own Module check this link walkswithme.net/joomla-module-development-tutorial - Jobin
Are you sure you mean a module? A module is an element that sits within the page template, as such you normally can only get it's content as part of the page. - Craig
@cppl yes, I am sure I'm talking about a module. Going to edit and try to be more specific - Alan Cor

1 Answers

1
votes

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" />