Ok, you will need to change 2 function (I suppose you use joomlacomment alpha3)
open components/com_comment/joscomment/comment.class.php
find the function getComments and change it with the one I've added.
function getComments($onlydata=false)
{
$database =& JFactory::getDBO();
if ($this->_sort_downward) {
$sort = 'DESC'; /* new first */
} else {
$sort = 'ASC'; /* last first */
}
$html = '';
$com = $this->_component;
/*
* ORDER must be done only on high level
* because children must be ordered ascending for tree construction
*/
$queryselect = "SELECT * ";
$querycount = "SELECT COUNT(*) ";
$queryfrom = "\nFROM jos_comment"
. "\n WHERE contentid='$this->_content_id' AND component='$com' "
. "\n AND published='1' ";
$queryparent = $this->_tree ? "\n AND parentid<=0 " : "";
$querychildren = $this->_tree ? "\n AND parentid>0 " : "";
$queryorder = "\n ORDER BY id $sort";
if ($this->_display_num>0) {
/*
* pages -> use limitstart on root id (childs are not counted - always attached to root id)
*/
if ($this->_comment_id) {
/*
* - get the limitstart(page) of the comment_id
* - comment id can be a root id but also a child !
* in this case, we must search for its root id.
*/
$parentid = $id = $this->_comment_id;
for ($i=1; $i<=20 && $parentid>0; $i++)
{ /* LEFT JOIN is for loop optimization : 1 loop = 2 levels */
/* 20 times is for infinity loop limit = maximum 40 levels. it should be enough....? :) */
$query = "SELECT c.id, c.parentid, p.id AS p_id, p.parentid AS p_parentid "
. "\n FROM jos_comment AS c LEFT JOIN jos_comment AS p ON c.parentid=p.id "
. "\n WHERE c.id=$parentid LIMIT 1";
$database->SetQuery($query);
$row = $database->loadAssocList();
if ($row=$row[0]) {
$id = $row['id'];
$parentid = $row['parentid'];
if ($row['parentid']>0) {
$id = $row['p_id'];
$parentid=$row['p_parentid'];
}
} else {
$id = $parentid = -1;
}
}
if ($id) {
/* get the limitstart from the root id */
$database->SetQuery("SELECT id ".$queryfrom.$queryparent.$queryorder);
$data = $database->loadResultArray();
$i = array_search($id, $data);
if ($i) $this->_limitstart = $i;
}
}
$database->SetQuery($querycount.$queryfrom.$queryparent.$queryorder);
$this->_total = $database->loadResult();
$checklimit = new JOSC_PageNav($this->_ajax, $this->_total, $this->_limitstart, $this->_display_num);
$this->_limitstart = $checklimit->limitstart;
$database->SetQuery($queryselect.$queryfrom.$queryparent.$queryorder, $this->_limitstart, $this->_display_num);
$dataparent = $database->loadAssocList();
} else {
$database->SetQuery($queryselect.$queryfrom.$queryparent.$queryorder);
$dataparent = $database->loadAssocList();
}
if ($this->_tree) {
$database->SetQuery($queryselect.$queryfrom.$querychildren."\n ORDER BY id ASC");
$datachildren = $database->loadAssocList();
$data = ($dataparent && count($datachildren)>0) ? array_merge($dataparent,$datachildren) : $dataparent;
} else {
$data = $dataparent;
}
//return "displ=".$this->_display_num;
//return JOSC_utils::debug_array($data);
/*
* $data is composed of ALL or ROOT array + CHILDREN array
* this means that position of a ROOT gives the page position.
*/
$postCSS = 1;
if (!$data && $onlydata) return $data;
if ($data != null) {
if ($this->_tree) $data = JOSC_utils::buildTree($data);
//return $data;
if ($onlydata) return $data; /* after the foreach */
if ($data != null) {
foreach($data as $item) {
$html .= $this->insertPost($item, $postCSS);
$postCSS++;
if ($postCSS == 3) $postCSS = 1;
}
}
}
$document = JFactory::getDocument();
$addjs = " var JOSC_postCSS=$postCSS;";
$document->addScriptDeclaration($addjs);
/* Daniel add-on for Allvideo Reloaded */
if (JPluginHelper::importPlugin('content', 'avreloaded')) {
$app = &JFactory::getApplication();
$res = $app->triggerEvent('onAvReloadedGetVideo', array($html));
if (is_array($res) && (count($res) == 1)) {
$html = $res[0];
}
}
return $html;
}
then after this function find the insertComments() and change it to this one
function insertComments()
{
$html = $this->getComments();
if(strcmp($html,'')) {
$output = $html;
} else {
// TODO: show some text when there is no comment - needs changes in the javascript file.
$output = '';
}
return "<div id='Comments'>".$output."</div>";
}
change $output = ''; to
$output = 'the text you wish to display when there are no comments';
and it should work.
As I said - when you publish new comment - the text will stay there, but after a refresh it will go away.