Keyword

Facebook comments module and K2 Category

  • Tarun Das
  • Tarun Das's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago #146534 by Tarun Das
Facebook comments module and K2 Category was created by Tarun Das
Hi Krikor,

Stuck up again. I have different K2 categories and menus are linked to those categories to list K2 items. Installed Phoca Facebook comments module for K2 items. Problem is comments also appears in K2 category listing. That's just list of articles and don't need any comments. Module Menu assignments points towards categories and hence the problem. Do you think this issue can be managed?
You can see what I am saying here yankeerussia.com/index.php/home/categories/economy

Regards
Tarun

Joomla! 3.4.3, K2 v2.6.9 (Eagerly waiting for v3)
Website: Yankee Russia

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 8 months ago #146542 by Krikor Boghossian
Replied by Krikor Boghossian on topic Facebook comments module and K2 Category
It can, you can do it with code in the template, and exclude that module position from the itemlist view ( JRequest::getCmd('view'); ) or you can use an extension like Modules Anywhere.

My approach however would be to ( since we are talking about a module ) to create a new position in the item.php file so it renders only inside items. You can also ask the Phoca folks if there is a plugin available.

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

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

  • Tarun Das
  • Tarun Das's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago #146582 by Tarun Das
Replied by Tarun Das on topic Facebook comments module and K2 Category
Oh ... common Krikor you know I am not a coder rather just a copy & paste master. So you got to tell me what exactly I have to copy and where to paste it. I did ask the Phoca guys about the solution but yet to receive any reply from them. Tell me the simplest approach of doing it ... as I know everything gonna be change in September when K2 v3 arrives. So I would not mind editing the code at this point.

Thank you for your help

Tarun

Joomla! 3.4.3, K2 v2.6.9 (Eagerly waiting for v3)
Website: Yankee Russia

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 8 months ago #146584 by Krikor Boghossian
Replied by Krikor Boghossian on topic Facebook comments module and K2 Category
The method (and the code) will be identical in v3 as well.
You can find a nice guide here. It is for standard articles but the method is same for K2 as well.

jure-stern.si/blog/position-joomla-modules-in-articles-categories-or-templates/

If you are using Modules Anywhere you can use {loadposition} instead of the entire code. Now this again is for modules. You really need an answer from the Phoca folks if there is a K2 plugin available which will make your life way easier.

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

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

  • Tarun Das
  • Tarun Das's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago #146664 by Tarun Das
All that I wanted was to add a FB comment module that would appear at the end of the item page of K2. The problem was that FB module would appear in K2 category listing pages too. I did not want that. Users need to comment only in the article not on the article lists. Sounds logical isn't it? So I was thinking how to remove that module from K2 Category listings. ( Wonder why nobody faced this problem before me). Module Anywhere is a wonderful extension. But it does not suit my requirement. Module Anywhere ADDs a module anywhere you want it does not REMOVE a module from the place you want. What Module Anywhere does is it makes a module acts like a plugin so that you can write the parameters in any writable area of your page. With Module Anywhere I had to put my FB comment module inside the introtext area of item pages as that's the only writable area of the page. ( I did not use Extra Fields). Now, think how it would look in a page if comments appears in the middle of the page before "Tagged under" and "Related Posts" things. Secondly, I have to edit all my old and future articles and put the Module Anywhere tag below it. That's certainly not the proper solution. For the same reason I did not use any FB comment plugin extension available for Joomla. The proper solution would be a module that appears only in K2 item pages. Extensive search in internet did not solve my problem. But Krikor gave me some hint in his reply when he wrote, "My approach however would be to create a new position in the item.php" . First I thought that would involve coding. Since I am not a coder and all my skills are limited to copy and paste ( that's ok with me, I am not a professional website maker, it's my hobby, I make websites only for non profit organisation for free) I searched in internet and found that two simple copy and paste would solve my problem. First I need to add a line:
<position>fbcomments</position>
in templateDetails.xml file. That would be my new module position name.
Second, I need to add a div at the end of the item.php file. This time I was lucky and found the code in Gavick site.
<div>
<?php
$position = 'fbcomments';
$params      = array('style'=>'gk_style');
$document   = &JFactory::getDocument();
$renderer   = $document->loadRenderer('module');
$contents = '';
foreach (JModuleHelper::getModules($position) as $mod)  {   
   $contents .= $renderer->render($mod, $params);
}
echo $contents;
?>
</div>

Those two simple cut and paste solved my problem. Thank you Krikor for your hint. Now you got to tell me whatever I did is right?

Regards
Tarun

Joomla! 3.4.3, K2 v2.6.9 (Eagerly waiting for v3)
Website: Yankee Russia

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 8 months ago #146685 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] Facebook comments module and K2 Category
Tarun your solution seems solid.
Another approach (just for reference) can be found here: www.joomlaworks.net/forum/k2-en/42546-module-position-in-k2-template

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

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

  • Tarun Das
  • Tarun Das's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago #146701 by Tarun Das
Thank you Krikor. Your code looks slimmer. But you did not give that to me in the first place. ;) You wanted me to sweat around a bit. Don't do that to me I am a heart patient ( joke :) )
I wrote down the procedure above for my future reference and for the people who may face similar problem.

Regards
Tarun.

Joomla! 3.4.3, K2 v2.6.9 (Eagerly waiting for v3)
Website: Yankee Russia

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 8 months ago #146714 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] Facebook comments module and K2 Category
Ehehehe I am a true sadist indeed :)
You did learn something useful today which can be applied in numerous occasions.

I think many users will benefit from this thread Tarun.

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

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


Powered by Kunena Forum