Joomla : load a module inside a component

To load a module inside a component, just paste below code inside in your component where you want to show the module.


<?php
 $modules =& JModuleHelper::getModules('contact');
 foreach ($modules as $module)
 {
echo JModuleHelper::renderModule($module);
 }
 ?>

Here  ‘contact’ is the module position

Advertisements

2 thoughts on “Joomla : load a module inside a component

  1. If i paste the above code i am not geting anything in my custom component.

    i pasted the above code in one of the div tag in my component. can any one please help me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s