giribabuvpy
Newbie
Karma: 0
Offline
Posts: 3
|
 |
« on: June 04, 2010, 13:23:27 » |
|
JComment working good in my K2 Component but I not able to see the Comment Count and Be the First comment any one can help me, where I have to change the code or any other solutions?  Regards, Hemanth.
|
|
|
|
|
Logged
|
|
|
|
|
smart
|
 |
« Reply #1 on: June 04, 2010, 13:38:59 » |
|
What integration type do you use? Do you've changed K2 template code or just installed K2 JComments plugin?
|
|
|
|
|
Logged
|
|
|
|
giribabuvpy
Newbie
Karma: 0
Offline
Posts: 3
|
 |
« Reply #2 on: June 04, 2010, 14:40:38 » |
|
Thanks, I got solution <?php $dbc=&JFactory::getDBO(); $sql="select count(*) from #__jcomments where object_id='".$this->item->id."';"; $run=$dbc->setQuery($sql); $count = $dbc->loadResult(); //echo $sql; if(isset($count) && $count<1) { echo <a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">Be the first to Comment </a>'; } else { echo '<a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">$count Comment(s)</a>'; } ?>
|
|
|
|
|
Logged
|
|
|
|
|
smart
|
 |
« Reply #3 on: June 04, 2010, 14:42:36 » |
|
Try to use K2 JComments plugin (it was released yesterday and available for downloads from our site). It allows to use JComments in K2 2.2 and higher without any code hacks.
|
|
|
|
|
Logged
|
|
|
|
giribabuvpy
Newbie
Karma: 0
Offline
Posts: 3
|
 |
« Reply #4 on: June 04, 2010, 14:47:39 » |
|
Sorry, Syntax error previous code, <?php $dbc=&JFactory::getDBO(); $sql="select count(*) from #__jcomments where object_id='".$this->item->id."';"; $run=$dbc->setQuery($sql); $count = $dbc->loadResult(); //echo $sql; if(isset($count) && $count<1) { echo '<a href='.$this->item->link.'#itemCommentsAnchor">Be the first to Comment </a>'; } else { echo '<a href='.$this->item->link.'#itemCommentsAnchor">'.$count.' Comment(s)</a>'; } ?> This is what I am expecting.
|
|
|
|
|
Logged
|
|
|
|
|
smart
|
 |
« Reply #5 on: June 04, 2010, 14:50:49 » |
|
Try to use plugin or change your code with: <?php $dbc=&JFactory::getDBO(); $sql="select count(*) from #__jcomments where object_group='com_k2' and object_id='".$this->item->id."';"; $dbc->setQuery($sql); $count = $dbc->loadResult(); if(!$count) { echo '<a href="' . $this->item->link . '#itemCommentsAnchor">Be the first to Comment </a>'; } else { echo '<a href="' . $this->item->link . '#itemCommentsAnchor">' . $count . ' Comment(s)</a>'; } ?>
|
|
|
|
|
Logged
|
|
|
|
ayande
Newbie
Karma: 0
Offline
Posts: 1
|
 |
« Reply #6 on: September 21, 2010, 09:45:58 » |
|
I don't understand were to put in the code you posted above?! I tried to install the plugin but the comment counter wont work, although everything else does work.
|
|
|
|
|
Logged
|
|
|
|
Masoud
Newbie
Karma: -1
Offline
Posts: 24
|
 |
« Reply #7 on: October 28, 2010, 11:07:17 » |
|
where we should put the code?
I have K2 Jcomment plugins but the comment counter does not work in category view , latest view, however it works properly in item view
|
|
|
|
|
Logged
|
|
|
|
marcodeluca
Newbie
Karma: 0
Offline
Posts: 5
|
 |
« Reply #8 on: February 01, 2011, 04:04:13 » |
|
Has there been a solution for this? The K2 / jcomments plugin works fine for the main component, but it does not work for modules like K2_content... it also does not work with 3rd party modules, like Rockettheme modules that integrate with K2.
|
|
|
|
|
Logged
|
|
|
|
rookpl
Newbie
Karma: 0
Offline
Posts: 5
|
 |
« Reply #9 on: February 03, 2011, 22:35:52 » |
|
Try to use plugin or change your code with: <?php $dbc=&JFactory::getDBO(); $sql="select count(*) from #__jcomments where object_group='com_k2' and object_id='".$this->item->id."';"; $dbc->setQuery($sql); $count = $dbc->loadResult(); if(!$count) { echo '<a href="' . $this->item->link . '#itemCommentsAnchor">Be the first to Comment </a>'; } else { echo '<a href="' . $this->item->link . '#itemCommentsAnchor">' . $count . ' Comment(s)</a>'; } ?> Thank you for hat code. I tried many solutions, and only with that code comments counters are visible on my main page. It adds one additional query per article. k2 plugin works, but counter is visible only in item view (after "read more" click), in category item list / front page it works only with that code.
|
|
|
|
|
Logged
|
|
|
|
BBC
Full Member
 
Karma: 4
Offline
Posts: 197
|
 |
« Reply #10 on: February 04, 2011, 00:23:40 » |
|
For counters in K2 you need to activate all comments options in K2. Parameters, Categories, Items. Otherways it wont count, doesn´t matter if you don´t use native K2 comments.
|
|
|
|
|
Logged
|
|
|
|
|
senseraw
Guest
|
 |
« Reply #11 on: May 27, 2011, 16:49:40 » |
|
smart, скажи пожалуйста какой код нужен, чтобы счётчик правильно работал для файлов generic.php и user.php
код выше работает корректно только для category_item.php
|
|
|
|
|
Logged
|
|
|
|
rygrath
Newbie
Karma: 0
Offline
Posts: 1
|
 |
« Reply #12 on: January 02, 2012, 09:31:06 » |
|
Try to use plugin or change your code with: <?php $dbc=&JFactory::getDBO(); $sql="select count(*) from #__jcomments where object_group='com_k2' and object_id='".$this->item->id."';"; $dbc->setQuery($sql); $count = $dbc->loadResult(); if(!$count) { echo '<a href="' . $this->item->link . '#itemCommentsAnchor">Be the first to Comment </a>'; } else { echo '<a href="' . $this->item->link . '#itemCommentsAnchor">' . $count . ' Comment(s)</a>'; } ?> Thank you for hat code. I tried many solutions, and only with that code comments counters are visible on my main page. It adds one additional query per article. k2 plugin works, but counter is visible only in item view (after "read more" click), in category item list / front page it works only with that code. Does anyone know where this code is inserted? I have the same issue with my site. On the frontpage / category item list, all comment links read as "Be the first to comment" regardless if there are comments or not. However, if I go into one specific K2 category, I can see the comment counter working properly for all items listed. The Frontpage setup is using the K2 category listing option with multiple categories selected. I've been wracking my head trying to fix this and I just can't seem to find the exact place where it's broken. I would greatly appreciate any assistance to this as everything else with Jcomments is working wonderfully. This is just the last little issue I have that I'd like to fix. Thank you for any responses! Edit: I should have put in some details. Running Joomla 1.5.25. Jcomments 2.2.0.2. K2 Jcomments plugin 1.2. Using the Yootheme Vanilla template.
|
|
|
|
« Last Edit: January 03, 2012, 05:31:10 by rygrath »
|
Logged
|
|
|
|
poiu98
Newbie
Karma: 0
Offline
Gender: 
Posts: 2
|
 |
« Reply #13 on: January 02, 2012, 19:20:41 » |
|
What integration type do you use? Do you've changed K2 template code or just installed K2 JComments plugin?
Thanks a lot ... this is my question to !
|
|
|
|
|
Logged
|
am i the only one who : acai
|
|
|
|