- Posts: 35
COMMUNITY FORUM
Adding Module Positions to K2 Content
- Heather
-
Topic Author
- Offline
- Junior Member
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.
- Jonah Kyle
-
- Offline
- New Member
- Posts: 4
Please Log in or Create an account to join the conversation.
- life
-
- Offline
- New Member
- Posts: 5
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
-
Topic Author
- Offline
- Junior Member
- Posts: 35
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.
- life
-
- Offline
- New Member
- Posts: 5
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.
- life
-
- Offline
- New Member
- Posts: 5
{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
-
Topic Author
- Offline
- Junior Member
- Posts: 35
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.
- Pixocom
-
- Offline
- New Member
- Posts: 2
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.
- Chris Yates
-
- Offline
- Senior Member
- Posts: 62
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
-
Topic Author
- Offline
- Junior Member
- Posts: 35
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.
- munyah
-
- Offline
- New Member
- Posts: 2
/* 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
-
Topic Author
- Offline
- Junior Member
- Posts: 35
Please Log in or Create an account to join the conversation.
- Heather
-
Topic Author
- Offline
- Junior Member
- Posts: 35
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.
- troponin
-
- Offline
- Platinum Member
- Posts: 398
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
-
Topic Author
- Offline
- Junior Member
- Posts: 35
Please Log in or Create an account to join the conversation.
- stavroch
-
- Offline
- Elite Member
- Posts: 295
/* get all Modules assigned to Position 'latest' */<br/> $latestItem = &JModuleHelper::getModules( 'latest' );<br/> <br/> /* loop through the array and render their output */<br/> foreach ($latestItem as $latest) {<br/> $_options = array( 'style' => 'xhtml' );<br/> echo JModuleHelper::renderModule($latest,$_options);<br/> }
from munyah user?
Please Log in or Create an account to join the conversation.
- stavroch
-
- Offline
- Elite Member
- Posts: 295
I see what you mean munyah.
Thank you! you have made great job.
Please Log in or Create an account to join the conversation.