- Posts: 53
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] Add a Module position to K2 Template do it better?
[SOLVED] Add a Module position to K2 Template do it better?
- Erwin Dicker
-
Topic Author
- Offline
- Senior Member
Less
More
11 years 9 months ago - 11 years 9 months ago #115683
by Erwin Dicker
[SOLVED] Add a Module position to K2 Template do it better? was created by Erwin Dicker
hi
i found two solutions
1. module anywhere and add this to the item.php
{modulepos test}
2.add this to item.php
< ?php $module = JModuleHelper::getModules('test');
echo JModuleHelper::renderModule($module[0]);? >
but how can i just put this in it and works ?
< jdoc:include type="modules" name="test" style="xhtml" / >
i found two solutions
1. module anywhere and add this to the item.php
{modulepos test}
2.add this to item.php
< ?php $module = JModuleHelper::getModules('test');
echo JModuleHelper::renderModule($module[0]);? >
but how can i just put this in it and works ?
< jdoc:include type="modules" name="test" style="xhtml" / >
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
11 years 9 months ago #115684
by Yiota
Replied by Yiota on topic Re: Add a Module position to K2 Template do it better?
Try this:
<?php foreach (JModuleHelper::getModules('test') as $module) {
echo JModuleHelper::renderModule($module, array('style' => 'xhtml'));
}?>
Please Log in or Create an account to join the conversation.
- Nikos
-
- Offline
- New Member
Less
More
- Posts: 17
11 years 1 month ago #115685
by Nikos
Replied by Nikos on topic Re: Add a Module position to K2 Template do it better?
Hello,
Where should I put this code? Everywhere I like into item.php file? What if my position called belowcontent then it would be like this?
Where should I put this code? Everywhere I like into item.php file? What if my position called belowcontent then it would be like this?
Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
11 years 1 month ago #115686
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: Add a Module position to K2 Template do it better?
@Nikos
If you put this code in your page ( K2 item.php layout for example ) then the module position "belowcontent" will be loaded in every item page. In that case the menu assignment in module page has no effect. You can also assign this module to "All Pages". This will not affect your site if this position is not loaded in your main template file.
If you put this code in your page ( K2 item.php layout for example ) then the module position "belowcontent" will be loaded in every item page. In that case the menu assignment in module page has no effect. You can also assign this module to "All Pages". This will not affect your site if this position is not loaded in your main template file.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Nikos
-
- Offline
- New Member
Less
More
- Posts: 17
11 years 1 month ago - 11 years 1 month ago #115687
by Nikos
So the module position is loading but what about the module itself? What more do I have to do than publishing it in belowcontent position without any assignment?
Replied by Nikos on topic Re: Add a Module position to K2 Template do it better?
Lefteris Kavadas wrote: @Nikos
If you put this code in your page ( K2 item.php layout for example ) then the module position "belowcontent" will be loaded in every item page. In that case the menu assignment in module page has no effect. You can also assign this module to "All Pages". This will not affect your site if this position is not loaded in your main template file.
So the module position is loading but what about the module itself? What more do I have to do than publishing it in belowcontent position without any assignment?
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
11 years 1 month ago #115688
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: Add a Module position to K2 Template do it better?
Publish the module. Also assign it to "All Pages" just in case this affects the output. If you have this position to your site also, then create another position and put the module there.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Nikos
-
- Offline
- New Member
Less
More
- Posts: 17
11 years 1 month ago - 11 years 1 month ago #115689
by Nikos
Replied by Nikos on topic Re: Add a Module position to K2 Template do it better?
I don't want it to be shown in all pages only in item page. In your opinion you suggest me to create another module position into k2 item.php file and publish the module in all pages? How can I do that just by entering
< jdoc:include type="modules" name="belowcontent_item" style="xhtml" / >
is that enough and then run the script above?
Do I have to change the xml template file?
< jdoc:include type="modules" name="belowcontent_item" style="xhtml" / >
is that enough and then run the script above?
Do I have to change the xml template file?
Please Log in or Create an account to join the conversation.
- Nikos
-
- Offline
- New Member
Less
More
- Posts: 17
11 years 1 month ago #115690
by Nikos
Replied by Nikos on topic Re: Add a Module position to K2 Template do it better?
yes it worked I just wrote at the end of the item.php
Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] Add a Module position to K2 Template do it better?