Keyword

[SOLVED] Module position in k2 template?

  • Roman Lipatov
  • Roman  Lipatov's Avatar Topic Author
  • Offline
  • New Member
More
8 years 9 months ago - 8 years 9 months ago #146621 by Roman Lipatov
[SOLVED] Module position in k2 template? was created by Roman Lipatov
Hi!
Is it possible to add module position in k2 template, for example in item.php
Thanks.
Last edit: 8 years 9 months ago by Roman Lipatov.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 9 months ago #146622 by Krikor Boghossian
Replied by Krikor Boghossian on topic Module position in k2 template?
Yes, the same way you load modules outside index.php in Joomla!

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Roman Lipatov
  • Roman  Lipatov's Avatar Topic Author
  • Offline
  • New Member
More
8 years 9 months ago #146623 by Roman Lipatov
Replied by Roman Lipatov on topic Module position in k2 template?
You talking about this method:
{loadmodule module[, title[, style]]}

or about this:
<jdoc:include type="modules" name="header" style="none" />

?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 9 months ago #146639 by Krikor Boghossian
Replied by Krikor Boghossian on topic Module position in k2 template?
Not really.
This is the code you should use:
<?php foreach (JModuleHelper::getModules('MODULE_NAME') as $module) {                                
echo JModuleHelper::renderModule($module, array('style' => 'MODULE_STYLE'));            
}?>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Roman Lipatov
  • Roman  Lipatov's Avatar Topic Author
  • Offline
  • New Member
More
8 years 9 months ago - 8 years 9 months ago #146643 by Roman Lipatov
Replied by Roman Lipatov on topic Module position in k2 template?
Thanks!
It works perfect.

Is this method more fast and correct than method with Nonumber Modules Anywhere?
{module Title}
Last edit: 8 years 9 months ago by Roman Lipatov.

Please Log in or Create an account to join the conversation.

More
8 years 9 months ago #146653 by Joe Campbell
Replied by Joe Campbell on topic Module position in k2 template?
Hi Roman,

The code Krikor provided can ONLY load a module position (outputs all modules assigned to that position).

While NoNumber Modules Anywhere can BOTH output an entire module position OR just one specific module.

Note: You can set Modules Anywhere to also handle the {loadposition} tags. In that case, you can safely disable the {loadposition} plugin all together.

Source: www.nonumber.nl/extensions/modulesanywhere

I hope this helps,

Joe Campbell

Please Log in or Create an account to join the conversation.

More
8 years 9 months ago - 8 years 9 months ago #146700 by Tarun Das
Replied by Tarun Das on topic [SOLVED] Module position in k2 template?
A word about Module Anywhere.
Module Anywhere is useful if you want your module to be appear in the textarea of K2 pages. In other words in introtext area. Because you need a writable place where you can put the name and parameters { xxxx xxx } of Module Anywhere. But if you want your module to be appear outside textarea you have to create a new module position in templateDetails.xml file and write the code Krikor provided in item.php page where MODULE_NAME = the new module position you created in templateDetails.xml file and MODULE_STYLE = your css class.

I faced this problem lately and here is how I solved it.

Joomla! 3.4.3, K2 v2.6.9 (Eagerly waiting for v3)
Website: Yankee Russia
Last edit: 8 years 9 months ago by Tarun Das.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum