Keyword

Assigned modules will not display on K2 Item

More
11 years 5 months ago #112242 by Benji
I am very new to K2 and I am still trying to figure out why everyone is raving about it and why it is better than the Joomla content management system. BUT now I am trying to use it and get used to the features. Here is a problem that I currently have.

SITE INFO:
Joomla 2.5.6
K2 Component version 2.5.7
Server: Linux

PROBLEM: I am trying to create a menu item that would display ONE article from the K2 component (K2 Item). So I have a K2 Item create called "Article1" and it is in a K2 category called "Category1". I have also created a module called "Module1" that displays a Menu Item. After I did this, I went to my Main Menu under Joomla menu manager and created a new menu item called "Article1" and used K2 Item as my menu item type. Selected the K2 Item "Article1" for the selected content. Now I went to the module manager and assigned "Module1" to several menu items including the menu item "Article1." HOWEVER, the module displays on all the pages I assigned it to EXCEPT the Article1 page.

Can some PLEASE tell me how to fix this? There must be a way to display a single article with modules assigned to right?? I have tried other modules and NO modules will display on this page. Can someone please tell me how to fix this. I really want to believe in the K2 Component but this will be a HUGE issue for me. What am I missing?

Thanks in advance...a K2 Novice! :oops:

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

More
11 years 5 months ago #112243 by Benji
***PLEASE NOTE: I am NOT looking for a solution that involves embedding modules into articles. There are plenty of extensions that can do that. I know how to do that. I am looking for a permanent K2 solution to this issue. Thank You!

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

More
11 years 5 months ago #112244 by Benji
[SOLVED]
:woohoo: Embarrassed a bit now. I have only been using Joomla for about a year so some things are still lost on me but I found my own solution here and this was probably the same way someone would do it using the Joomla standard content management system as well...guess this is just the first project that I needed the feature.

SOLTUION: When you create a new menu item that is K2 Item, you need to use the parameter on the right called "Module Assignment for This Menu Item" in order to assign modules to display on that particular article (K2 Item).

Out of curiosity...anyone know why you can't just assign a module to a K2 Item under the parameters for that module? Why do you have to assign a module to a single K2 Item using the Menu Manager? Just asking...

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago #112245 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Assigned modules will not display on K2 Item
Hello Benji,

Another approach is to hardcode it your template,
You can have an if statement (if option is K2 and the task is item) and output an entire module position to be visible only inside K2 items.

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

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

More
10 years 10 months ago #112246 by Benji
Krikor,

I am working on a different website now and I have come across this same issue again. However, I DID check that the particular module IS already assigned on the menu item. Can you please give me some direction on writing the if/then statement. I am a designer and not really familar with writing those kinds of statements.

Thanks in advance! :)

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

More
10 years 10 months ago #112247 by Benji
Ok. Found that I could just put {loadposition myposition} at the bottom of my article. Apparently this neat little shortcode loads the modules that are in that position (myposition) and are assigned to that menu item.

Still not sure this a complete fix for my issue. I suspect that there is something within the template (not sure what template) that is disabling all module positions on a page when the menu item is "K2 Item."

.......will keep adding....hope this helps someone out. :huh:

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 10 months ago #112248 by Yiota
Thank you for sharing this.

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

More
10 years 10 months ago #112249 by Benji
Still wish that I could figure out how to write the script to LOAD ALL POSTIONS for K2 Item. This would allow modules to be placed on Menu Item:K2 Item without adding the shortcode on the item. Seems like the script would need to be written here: dir/templates/theme/html/com_k2/default/item.php but I have no idea HOW to write the script. Anyone want to contribute? :S

THANKS!

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 10 months ago #112250 by Yiota
You could add this code to load a module position through item.php file (for Joomla! 2.5.x, not tested for Joomla! 3.2)
<?php if(JModuleHelper::getModules('YOUR_MODULE_POSITION')): ?>
  <?php foreach (JModuleHelper::getModules('YOUR_MODULE_POSITION') as $module) {?>      
    <?php echo JModuleHelper::renderModule($module, array('style' => 'YOUR_MODULE_STYLE')); ?>     
  <?php }?>
<?php endif; ?>

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

More
10 years 6 months ago #112251 by Benji
{PERMANENT SOLUTION} :P

It has been a while since I have been able to get back here to post the final solution. My issue was because there was a line of code found in my template's index.php file that disabled each module position. So if you are having an issue with moduels NOT showing on your pages that are menu type "K2 Item", you might want to check your index.php that is located here:

dir/templates/yourtheme/index.php

You want to look for the lines of code where your theme's module positions are defined. At the beginning of each module position definition, look for a piece of code that looks like this:
Log in  or Create an account to join the conversation.