How to call module in component

Discuss Search Engine Optimization in relation to Joomla!. This forum will also have discussions on SEF/SEO Joomla! extensions.

Moderator: General Support Moderators

Locked
muthu_0101
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Mon Feb 11, 2008 10:42 pm
Location: Chennai

How to call module in component

Post by muthu_0101 » Sat Dec 27, 2008 6:47 am

Dear All,

I want to call module in my component, please help me how can i do it?

Thanks & Regards,
Muthu

smartidiot
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Thu Aug 28, 2008 7:56 am

Re: How to call module in component

Post by smartidiot » Sat Dec 27, 2008 2:48 pm

Modules can be placed anywhere on the page, including component page. You can specify the position in module settings. And if you meant how to place a module inside contents then you can use {loadposition position} directive.

Hope this helps!
Shishir
http://www.affiliateplugin.com Affiliate Marketing Community[/url]

Signature rules - only literal URL's

sudirman123
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon Jul 14, 2008 4:29 am

Re: How to call module in component

Post by sudirman123 » Thu Jan 01, 2009 8:35 am

There is 2 way to call Module :

Call Module within Content/Article : you can use {loadposition position} (thanks to plgContentLoadModule - /plugins/content/loadmodule.php)

Call Module programatically (Module call another Module or Component call Module) :

A. Call Module by position :

$position = 'left';
$contents = '';
foreach (JModuleHelper::getModules($position) as $mod) {
$contents .= $renderer->render($mod, $params);
}

B. Call Module by name :

$modName = 'mostread '; // not mod_mostread
$modTitle = 'Popular';
$mod = JModuleHelper::getModule($modName, $modTitle);
$content = JModuleHelper::renderModule($mod);

Storbastan
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Dec 29, 2008 1:25 pm
Location: Malmö
Contact:

Re: How to call module in component

Post by Storbastan » Wed Feb 11, 2009 11:54 am

I can't either of this to work. Something with the render. Any one got this to work?

seshu_noolu
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Thu Jul 16, 2009 3:53 am

Re: How to call module in component

Post by seshu_noolu » Tue Jul 21, 2009 9:45 am

Hello,

There is a solution for this.
you can call module by its position like this any where in the code like "components/modules"
$modules =& JModuleHelper::getModules('breadcrumb');
foreach ($modules as $module)
{
echo JModuleHelper::renderModule($module);
}

Here "breadcrumb" is the module position you can use any..

Thanks.

Storbastan
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Dec 29, 2008 1:25 pm
Location: Malmö
Contact:

Re: How to call module in component

Post by Storbastan » Tue Jul 21, 2009 10:56 am

Thank you!

I did it like this, and it works so far :)

Code: Select all

$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$options = array('style'=>'raw');
echo $renderer->render('artistPlayer',$options,null);

User avatar
Ghonjez
Joomla! Exemplar
Joomla! Exemplar
Posts: 8770
Joined: Sat Oct 18, 2008 3:02 am
Location: Mars
Contact:

Re: How to call module in component

Post by Ghonjez » Wed Jul 22, 2009 6:34 am

Hi...

For insert module into component, you can also use this extension :
Modules Anywhere : http://extensions.joomla.org/extensions ... 02/details

Hope helps :)

tejaswi-333
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Aug 14, 2012 7:17 am

Re: How to call module in component

Post by tejaswi-333 » Thu Aug 30, 2012 10:54 am

Hi,
Please, can some one help me how to call a module in custom component in joomla2.5


Locked

Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 1.5”