i already add this code to comment.class.php
/*
* makes a profile link to CB
*
* @access public
* @param mixed $s - user name
* @param int $id - user id
* @return - html link to profile or just the user name if id is missing
*/
function profileLink($s, $id)
{
if(strcmp($id,'')) {
$link = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='.$id);
return "<a href='$link'>".$s."</a>";
} else {
return $s;
}
}
/**
* creates the write more( Number of comments) button
* and generated the comment preview
* @return html
*/
function insertCountButton()
{
$address = $this->_comObject->linkToContent( $this->_content_id );
$number = $this->countComments();
$html = $this->_readon;
/* {READON_xxx} */
$html = str_replace('{READON_LINK}', $address , $html);
$html = str_replace('{READON_WRITE_COMMENT}', _JOOMLACOMMENT_WRITECOMMENT, $html);
$html = str_replace('{READON_COUNT}', $number, $html);
$html = str_replace('{READON_COMMENTS}', $this->comments($number), $html);
/* {BLOCK-preview} */
if ($this->_preview_visible) {
$database =& JFactory::getDBO();
$database->SetQuery("SELECT * FROM jos_comment WHERE contentid='$this->_content_id' AND component='$com' AND published='1' ORDER BY date DESC");
$data = $database->loadAssocList();
}
$display = $this->_preview_visible && ($data!=null);
$html = JOSC_utils::checkBlock('BLOCK-preview', $display, $html);
if ($display) {
$index = 0;
$previewlines = '';
foreach($data as $item) {
if ($index >= $this->_preview_lines)
break;
if ($item['title'] != '') {
$title = stripslashes($item['title']);
} else {
$title = stripslashes($item['comment']);
}
if (JString::strlen($title) > $this->_preview_length)
$title = JString::substr($title, 0, $this->_preview_length) . '...';
$previewline = $this->_previewline;
/* {username} */
$previewline = str_replace('{username}', $this->profileLink($name, $this->_user_id), $previewline);
/* {avatar_picture} */
$previewline = str_replace('{avatar_picture}', $this->profileLink("<img class='avatar' src='$path' alt='avatar' />", $this->_user_id), $previewline);
/* {PREVIEW_LINK} */
$previewline = str_replace('{PREVIEW_LINK}', $address, $previewline);
/* {PREVIEW_DATE} */
$previewline = str_replace('{PREVIEW_DATE}', JOSC_utils::getLocalDate($item['date'],$this->_date_format) , $previewline);//date($this->_date_format,strtotime($item['date'])) , $previewline);
/* {PREVIEW_TITLE} */
$previewline = str_replace('{PREVIEW_TITLE}', $title, $previewline);
/* {PREVIEW_TITLE} */
$previewline = str_replace('{id}', $item['id'], $previewline);
$index++;
$previewlines .= $previewline;
}
/* {preview-lines} */
$html = str_replace('{preview-lines}', $previewlines, $html);
}
return $html;
}
and this code to index.html
{previewline}
<div class='comment_preview'>
<div>{username}</div>
{avatar_picture} <a href="{PREVIEW_LINK}#josc{id}">{PREVIEW_DATE}<b>{PREVIEW_TITLE}</b></a>
</div>
{/previewline}
but not working
anyone can help?