Display Joomla Module inside K2 Component (com_k2)

The good thing about K2 is you can customize your layout according to your will. But what if you need to display some modules?

Unfortunately K2 does not allow you to just use <jdoc:include>

Therefore, we have to go a different way by fetching module using JModuleHelper.

The snippet below will allow K2 to display all modules that have popup-form position. The if statement is there to allow fail safe when there is no module

 

If you want to display only the first module of that position, you can do the following trick:

That’s it folks! To display module in com_k2, we need to use JModuleHelper.

Leave a reply:

Your email address will not be published.