I'm trying to add komento comments count add to article at below file



                    $query->select(' COUNT(jc.id) AS comments_count, MAX(jc.created) AS comments_date')
                    ->join('LEFT', '#__komento_comments AS jc ON jc.cid = a.id AND jc.component = \'com_content\' AND jc.published = 1');

and use this code for fetch

<?php echo $this->item->comments_count; ?>

but not show comments count ad get error

  • Please show us your efforts before posting your question. It is important that this community is not used as a free coding service. We don't mind pitching in if you are stuck, but if you need a professional developer that is another matter. Questions that require "hands-on professional development" are off-topic here. When you edit your question to show your best coding attempt and the reason that it failed to meet your expectations, please also bother to capitalize the word i so that nobody else will need to clean up your post. I upvote clear, on-topic questions that don't need editing. – mickmackusa Jun 4 '19 at 21:18
  • @mickmackusa thanks for help – niaziblog Jun 5 '19 at 10:50
  • What is the error? Where is the from() call? $this->item doesn't fetch query results. Do you also need to extract the most recent date? – mickmackusa Jun 5 '19 at 11:05
  • Is $comments_link relevant to your question? If not, please remove it. Looks like you don't need a JOIN. Do you mean to use FROM instead? – mickmackusa Jun 5 '19 at 11:11
  • @mickmackusa $comment_link deleted from code ...i want get comment count related post from database and show at article – niaziblog Jun 5 '19 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.