kennyevo
kennyevo

Reputation: 681

Load Joomla module when document is loaded

I wrote a module, but it slows down the page's loading time. I searched how to load modules with ajax, but did not find any useful topics (or just didn't understand them, english is not my native language). My question is: If i have a module, which lists the online members on a game server(but only if they exists in the local database), what is the correct solution to load this module after the page is loaded?

Upvotes: 1

Views: 1355

Answers (1)

Jobin
Jobin

Reputation: 8272

Try this.

Make an ajax call to any of your custom component task. And the code inside that task should be like

 $document = &JFactory::getDocument();
 $renderer = $document->loadRenderer('module');

 $Module = &JModuleHelper::getModule('mod_fmDataGrid');

 $Params = "param1=bruno\n\rparam2=chris";
 $Module->params = $Params;
 echo $renderer->render($Module);

the result you can return via ajax , and use in your html.

The other Options is

the link Also describing a good details but its using via module override concept. You can follow any of these method

Hope this may help you..

Upvotes: 2

Related Questions