Add new module position in content OR in component file

Varun
add-new-module-position-in-content-or-in-component-file

As far as customization concern Joomla become very famous for its flexibility of each parts. In some cases we need to use module in content section or within content. So how we can make it possible?

Here we I explain two way based on where we have requirement of module.

Load module in article :

->If we have such case in which we have to put our module within article OR within our component section. That time we just have to put

{loadposition position_name}

short code to load position. Then set required module to that particular position. If position is new then don’t forget to add this position in templateDetails.xml file. Check if the plugin load module is enable . Now you can load module by selecting this position to anywhere within content.

Load module in custom component file:

->When we are making any custom component or trying to customize existing component and for some functionality we require to add position to that particular component then we can load position by using below code:

$modules = JModuleHelper::getModules('positionname');
foreach($modules as $module)
{
echo JModuleHelper::renderModule($module);
}

Here in place of position name you can write any position name which you wish to load. Then follow same procedure as above. This way doesn’t require any plugin support. This is we are doing by custom code.

Hope this helps you guys…

Keep it up..
Coreway Solution 🙂

Business
info@corewaysolution.com
© 2023, Corewaysolution. All Rights Reserved. Privacy Policy | Refund Policy