Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    General discussion    Topic: Jateline III and comments count in frontpage
Pages: [1]   Go Down
  Print  
Author Topic: Jateline III and comments count in frontpage  (Read 1507 times)
0 Members and 1 Guest are viewing this topic.
sosh2005
Newbie
*

Karma: 0
Offline Offline

Posts: 1


« on: December 02, 2010, 03:23:43 »

Hi everyone! im now to jcomments, i have to say that far as i know and see is the best!!
i found in a topic how to insert the comments count in the front page of a default template,


1. Open file /templates/ja_purity/html/com_content/frontpage/default_item.php
2. Find code:
Code: (php)
Code:
<a href="<?php echo $this->item->readmore_link?>" class="contentpagetitle<?php echo $this->escape($this->item->params->get'pageclass_sfx' )); ?>">
<?php echo $this->escape($this->item->title); ?>
</a>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>

and replace with:
Code: (php)

<?php 
        
$commentsCount 0;
        $commentsBlock '';
$commentsAPI JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php';
if (is_file($commentsAPI)) {
require_once($commentsAPI);
$config = & JCommentsFactory::getConfig();
$categoryEnabled JCommentsContentPluginHelper::checkCategory($this->item->catid);

if ($categoryEnabled) {
$commentsCount JComments::getCommentsCount($this->item->id'com_content');
if ($commentsCount) {
$commentsBlock '<span class="comments-counter"><a href="'.$this->item->readmore_link.'#comments">'.$commentsCount."</a></span>";
} else {
$commentsBlock '<span class="comments-counter"><a href="'.$this->item->readmore_link.#addcomment">0</a></span>";
}
}
}
?>

<a href="<?php echo $this->item->readmore_link?>" class="contentpagetitle<?php echo $this->escape($this->item->params->get'pageclass_sfx' )); ?>">
<?php echo $this->escape($this->item->title); ?>
</a>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
<?php echo $commentsBlock?>

In this case you'll have block with comments count after article title will be able to style it as you needed. Same modification you'll be needed to make with section and category blog templates.


but the thing is that when i try to use that code in my jateline template frontpage my website just dont show up at all! hehehe

i let you my code of frontpage layout:

Code:
<?php
//get Itemid of category
/*
if ($catorsec) {
$catlink   = JRoute::_(ContentHelperRoute::getCategoryRoute($rows[0]->catslug, $rows[0]->sectionid));
}else{
$catlink   = JRoute::_(ContentHelperRoute::getSectionRoute($rows[0]->sectionid));
$cattitle = ($catorsec) ? $rows[0]->cattitle:$rows[0]->sectitle;
$catdesc = ($catorsec) ? $rows[0]->catdesc:$rows[0]->secdesc;
}*/
$rows $cat->contents;
$cid $cat->category->id;
$slug $cat->category->slug;
$ctitle $cat->category->title;
$cdesc $cat->category->description;
$clink   JRoute::_(ContentHelperRoute::getCategoryRoute($slug$sid));

$cls_sufix trim($params->get('blog_theme',''));

if($cls_sufix$cls_sufix '-'.$cls_sufix;
?>

<div class="ja-box column ja-zintheme<?php echo $cls_sufix;?>">
<div class="inner clearfix">
<?php if ($showcattitle) : ?>
<div class="ja-zincat clearfix">
<h3>
<a href="<?php echo $clink;?>" title="<?php echo trim(strip_tags($cdesc));?>">
<span><?php echo $ctitle;?></span>
</a>
</h3>
</div>
<?php endif; ?>
<?php
$i 0;
while($i $s_introitems && $i<count($rows)) {
$row $rows[$i];
$link   JRoute::_(ContentHelperRoute::getArticleRoute($row->slug$row->catslug$row->sectionid));
$image $helper->replaceImage ($row$img_align$autoresize$maxchars$s_showimage$img_w$img_h$hiddenClasses);
//Show the latest news
?>

<div class="ja-zincontent clearfix">

<?php if ($s_showimage && $image) : ?>
<div class="ja-zinimg" style="width:<?php echo $img_w;?>px;height:<?php echo $img_h;?>px;">
<?php echo $image?>
</div>
<?php endif; ?>

<h4 class="ja-zintitle"><a href="<?php echo $link;?>" title="<?php echo strip_tags($row->title);?>"><?php echo $row->title;?></a></h4>

<?php if ($showcreater||$showdate) : ?>
<div class="ja-zinmeta clearfix">
<?php if ($showdate) : ?>
<span class="createdate"><?php echo JHTML::_('date'$row->createdJText::_('DATE_FORMAT_LC4'));?> <?php if ($showcreater) : ?> &nbsp;|&nbsp; <?php endif; ?> </span>
<?php endif; ?>
<?php if ($showcreater) : ?>
<span class="createby"><?php echo $row->creater;?></span>
<?php endif; ?>
</div>
<?php endif; ?>

<?php 
     if($maxchars strlen($row->introtext1)) {
      echo $row->introtext;
     } else {
      echo $row->introtext1;
     }
?>

<?php if ($showreadmore) : ?>
<a href="<?php echo $link?>" class="readon" title="<?php echo JText::sprintf('Read more...');?>"><span><?php echo JText::sprintf('Read more...');?></span></a>
<?php endif; ?>
</div>

<?php
$i++;
}

if (count ($rows) > $i) {
echo "<div class=\"ja-zinlinks\">\n";
echo "<strong>".JTEXT::_('Mas noticias:')."</strong>\n";
echo "<ul>\n";
  

  
while (count ($rows) > $i) {
  
$row $rows[$i];
  
$link   JRoute::_(ContentHelperRoute::getArticleRoute($row->slug$row->catslug$row->sectionid.""));
?>

   <li>
   <a title="<?php echo trim(strip_tags($row->title), '"'); ?>" href="<?php echo $link?>">
   <?php echo $row->title?></a>
   </li>
<?php
  
$i++;
  
}
  
echo "</ul></div>\n";

?>

</div>
</div>

i dont know how to put the php code to show up the comments count there, every where i tried it just screw the site :S

i hope you can helpe me!
regards
carlos!
« Last Edit: December 03, 2010, 06:34:59 by sosh2005 » Logged
de12
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« Reply #1 on: May 11, 2011, 16:00:23 »


I would really appreciate if the technical team of Jcomment provides us with the guideline about the integration, I am using Ja teline III v2 with Ja News Frontpage module  (v1.40).
Logged
shorty
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« Reply #2 on: August 29, 2011, 14:15:00 »

Sorry to bump an old thread but this thread can be found when googling jcomments frontpage template, so I thought it would be worth replying in  case anyone else comes here looking for help like I did.

There's simply an error in the PHP code in the first box, on line 25 a quote mark is missing. With this error your code will break. Also if you're copying it to a different template, ie not replacing the code mentioned in OP, obviously the else/endif will be broken. Otherwise it works fine at getting the comment count in a custom frontpage template Smiley

Slight fix:

Code:
<?php 
        
$commentsCount 0;
        $commentsBlock '';
$commentsAPI JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php';
if (is_file($commentsAPI)) {
require_once($commentsAPI);
$config = & JCommentsFactory::getConfig();
$categoryEnabled JCommentsContentPluginHelper::checkCategory($this->item->catid);

if ($categoryEnabled) {
$commentsCount JComments::getCommentsCount($this->item->id'com_content');
if ($commentsCount) {
$commentsBlock '<span class="comments-counter"><a href="'.$this->item->readmore_link.'#comments">'.$commentsCount.'</a></span>';
} else {
$commentsBlock '<span class="comments-counter"><a href="'.$this->item->readmore_link.'#addcomment">0</a></span>';
}
}
}
?>


<?php echo $this->escape($this->item->title); ?>
</a>
<?php echo $commentsBlock?>

If you just want the count, scrap the last line and echo $commentsCount instead.
« Last Edit: August 29, 2011, 14:16:53 by shorty » Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    General discussion    Topic: Jateline III and comments count in frontpage
 
Jump to: