Keyword

Adding Module Positions to K2 Content

  • Heather
  • Heather's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 8 months ago #71018 by Heather
Adding Module Positions to K2 Content was created by Heather
I would like to add a few module positions to the item view of K2 content for a sports site I am working on (a big deal).

They'd like to have a few positions available, and I'm hoping someone here could give me the basics of how I might add one in.

Thanks!

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

More
15 years 8 months ago #71019 by Jonah Kyle
Replied by Jonah Kyle on topic Adding Module Positions to K2 Content
I've been looking for the same thing. Specifically, in Joomla one can use the {loadposition xxx} statement in a Joomla article, where xxx is the position that holds modules. Is there a similar function here?

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

More
15 years 8 months ago #71020 by life
Replied by life on topic Adding Module Positions to K2 Content
did you found solution?

I'm trying to include module in K2 template.
I used both forms. Jdoc: and mosLoadModile. No one of them doesn't work.

I wish to put banner module between Leading and Primary blocks on category page.
I used /com_k2/templates/default/category.php

Anybody has ideas how to resolve it?

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

  • Heather
  • Heather's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 8 months ago #71021 by Heather
Replied by Heather on topic Adding Module Positions to K2 Content
I found this: forum.joomla.org/viewtopic.php?t=208387

I haven't tried it yet, but will probably try it out today or tomorrow.

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

More
15 years 8 months ago #71022 by life
Replied by life on topic Adding Module Positions to K2 Content
I've tested. It works in article.
Tomorrow I'm plannin to put it in content.php and test how it works in K2 layout. I hope it will.

The Someex said:I found this: forum.joomla.org/viewtopic.php?t=208387
I haven't tried it yet, but will probably try it out today or tomorrow.

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

More
15 years 8 months ago #71023 by life
Replied by life on topic Adding Module Positions to K2 Content
I've tryed to add extended module in article. It works with if you use
{loadposition user7}
Where user7 is position for your module

If you want to add module in other component, not com_content you have to use following php-code

Result here: street-style.ru/v2/
I put banner between Leading and Primary block in K2 layout.

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

  • Heather
  • Heather's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 7 months ago #71024 by Heather
Replied by Heather on topic Adding Module Positions to K2 Content
Ok, I have to admit that I am stumped. My goal is to add two module positions to the K2 item.php file. I tried your php code and it would not work for me (I could be brain dead). Any thoughts?

Ideally, I'd like one here (I replace the code arrows with *, so the code would show):

*div class="itemHeader"*

*div id="center" class="float_right"* CENTER MODULE POSITION HERE */div*

*span class="itemDateCreated"* */span*


--

If you have any thoughts on this, I would be eternally grateful. Thanks!

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

More
15 years 6 months ago #71025 by Pixocom
Replied by Pixocom on topic Adding Module Positions to K2 Content
Hi... Im trying to do exactly the same... can you share the php code ?
The link is broken

thanks

Ksenya said:I've tryed to add extended module in article. It works with if you use{loadposition user7}Where user7 is position for your moduleIf you want to add module in other component, not com_content you have to use following php-codeResult here: street-style.ru/v2/I put banner between Leading and Primary block in K2 layout.

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

More
15 years 6 months ago #71026 by Chris Yates
Replied by Chris Yates on topic Adding Module Positions to K2 Content
Hi,

A quick and dirty solution to this question is to use the 'Modules Anywhere' plugin downloadable from the Joomla website.

I can confirm that I have tried it and it does work.

In operation you just place the appropriate tags and name of module in your K2 content where you want it to appear and it appears.

Best,

CHRIS

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

  • Heather
  • Heather's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 6 months ago #71027 by Heather
Replied by Heather on topic Adding Module Positions to K2 Content
A quick and dirty solution to this question is to use the 'Modules Anywhere' plugin downloadable from the Joomla website.
I can confirm that I have tried it and it does work.


Interesting. I tried it, and it did not work. Perhaps I'll have to try again. Thanks for the note.

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

More
15 years 5 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
15 years 4 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
15 years 4 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
15 years 3 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
15 years 3 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
14 years 3 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
14 years 3 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