Keyword

Adding Module Positions to K2 Content

More
14 years 9 months ago #71028 by munyah
Replied by munyah on topic Adding Module Positions to K2 Content
I have successfully done this. I wanted to add module positions into my item.php and I did it like so :
/* get all Modules assigned to Position 'latest' */
$latestItem = &JModuleHelper::getModules( 'latest' );

/* loop through the array and render their output */
foreach ($latestItem as $latest) {
$_options = array( 'style' => 'xhtml' );
echo JModuleHelper::renderModule($latest,$_options);
}


It is pretty straight forward. There are other options that one can use: thanks to someone who linked to the joomla forums, I got the solution pretty easily.

The link for some who may have missed it: forum.joomla.org/viewtopic.php?t=208387

Happy hacking :)

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

  • Heather
  • Heather's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 9 months ago #71029 by Heather
Replied by Heather on topic Adding Module Positions to K2 Content
I found that after a bit of wiggling, I did get Modules Anywhere to work. There was some fiddly stuff, but it came through.

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

  • Heather
  • Heather's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 9 months ago #71030 by Heather
Replied by Heather on topic Adding Module Positions to K2 Content
Well, the big things were:

1. Make sure that plugins are enabled in K2.

2. Make sure that the module is published AND available on the correct page.

3. Publish the module to a specific module position JUST for that article/plugin. (I named mine ma_modulename, so I would know exactly which go where.)

- If you don't know how to add new module positions for this, simply go tot he module position box (where you would normally choose from the available modules), and use it as a text box to just enter in the new module position name. Save that name (of course) to use in the article.

It was a bit persnickity making it happen, since there was no support from either K2 or MA, but once I fiddled with everything it got working.

It's not for the faint of heart the first few times, just because of all the settings that can go wrong, but once you have it set up, it's easy to clone.

Good luck!

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

More
14 years 8 months ago #71031 by troponin
Replied by troponin on topic Adding Module Positions to K2 Content
hey,

is it possible to set a function like :

< ? php if($this->countModules('right')) : ? >
I would only like to set the div for the "extra" Module Position if a Module is published.

thx

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

  • Heather
  • Heather's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 8 months ago #71032 by Heather
Replied by Heather on topic Adding Module Positions to K2 Content
Well, ModulesAnywhere only works when you put it into the content, so there is no worry about anything when there are no modules published there.

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

More
13 years 8 months ago #71033 by stavroch
Replied by stavroch on topic Adding Module Positions to K2 Content
So if I want to display module position on the item.php I have to pay 20 euro to www.nonumber.nl for having commercial version and then to type

 
/* get all Modules assigned to Position 'latest' */<br/> $latestItem = &amp;JModuleHelper::getModules( 'latest' );<br/> <br/> /* loop through the array and render their output */<br/> foreach ($latestItem as $latest) {<br/> $_options = array( 'style' =&gt; 'xhtml' );<br/> echo JModuleHelper::renderModule($latest,$_options);<br/> }

from munyah user?

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

More
13 years 8 months ago #71034 by stavroch
Replied by stavroch on topic Adding Module Positions to K2 Content
Sorry for my previous post.

I see what you mean munyah.

Thank you! you have made great job.

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


Powered by Kunena Forum