Buy Now
Sign in

[Hack 1.2] about << Title >>, what I have forget ? [Solved]

potus , June 23 2009

I would like add field << Title >> in your beautiful component. But I have a last problem with this developpement : {comment_title} is not replace by my value !

1. Function LoadComment in chronocomments.php (add line 63)

01function LoadComment($commentid, $comment_item){
02   global $mainframe;
03   $database =& JFactory::getDBO();
04   $configs = JComponentHelper::getParams('com_chronocomments');
05   //load current comment data
06   $query = "SELECT * FROM #__chrono_comments WHERE id = '".$commentid."'";
07   $database->setQuery( $query );
08   $commentx = $database->loadObject();
09   //define comment elements
10   //$comment_elements = array('id', 'name', 'email', 'url', 'text', 'datetime', 'rating', 'title');
51   //render the comment template
52   $comment_elements = array(
53      'id' => $commentx->id,
54      'name' => censor($commentx->name),
55      'email' => $commentx->email,
56      'url' => $commentx->url,
57      'text' => censor(bb2html($commentx->text)),
58      'datetime' => '<a href="#commentID'.$commentx->id.'">'.JHTML::_('date', $commentx->datetime, JText::_( 'DATETIMEFORMAT' )).'</a>',
59      'rating' => $commentx->rating,
60      'parentid' => $commentx->parentid,
61      'avatar' => $avatar ? $avatar : JURI::Base().'components/com_chronocomments/images/avatar1.png',
62      'userid' => $commentx->userid,
63      'title' => $commentx->title
64   );
65   foreach($comment_elements as $comment_element_name => $comment_element_value){         
66      $current_comment_item = preg_replace("/\\{comment_".$comment_element_name."\\}/", $comment_element_value, $current_comment_item);
67   }
68   return str_replace("{REPLIES}", $comment_items, $current_comment_item);

2. templates\comment-item.html.php (lines 9 to 11 added)
				01<div class="comment-item" id="commentID{comment_id}">
02    <div class="comment-item-header"><a name="commentID{comment_id}"></a>
03    {a_comment_avatar}<img src="{comment_avatar}" alt="avatar" class="avatar" width="26" height="26" />{/a_comment_avatar}
04 <{if_comment_url}a href="{comment_url}"{/if_comment_url} class="nickname-link">{comment_name}</{if_comment_url}a{/if_comment_url}>{if_user_reputation}<span class="bullet">&bull;</span> <div class="rep-score"><div class="rep-score-left"></div><div class="rep-score-center">{user_reputation}</div><div class="rep-score-right"></div></div>{/if_user_reputation}
05 <div class="rating">
06 <div class="score" id="score{comment_id}">{comment_rating}</div> <div id="plus_{comment_id}" class="rating-plus" onmouseover="showPlus(;" onClick="addPlus({comment_id});" onmouseout="hidePlus(;">&nbsp;</div> <div id="minus_{comment_id}" class="rating-minus" onmouseover="showMinus(;" onClick="addMinus({comment_id});" onmouseout="hideMinus(;">&nbsp;</div>
07 </div>
08 </div>
09      <div class="comment-title">
10         {comment_title}
11      </div>

3. Screenshot
I checked that I had saved data in the table, this part works.

You can say me what I have forget ?

NB : If Max think this hack is interesting, I could send to him by private message or even all publish. It is not yet completely finished, particularly in the administration and also for this display problem.


As you can see I'm new here, I also began developing php. I need a little help to solve the problem that I submitted, my goal is not to bother you too.

I think what Max have doing is very good job and I prepare a parallel translation into French of the version 1.2. I am not saying this to you to help me faster, but for explain the interest that I find in ChronoComment.


I have no reponse of Max because :
- he has no time to answer me ?
- he has no idea ?
- he don't want on his Chronocomments any changes ?

I have look all files and don't understand why I have {comment_title} and not his value.

You can help me ??

For information, I have modify this file chronocomments.class.php and inside this function

				class TableChronoComments extends JTable {
   // Declaration and initialisation of the instantiation variable
   var $id=null;
   var $component=null;
   var $pageid=null;
   var $parentid=null;
   var $userid=null;
   var $name=null;
   var $email=null;
   var $url=null;
   var $text=null;
   var $datetime=null;
   var $rating= 0;
   var $verify= 0;
   var $uniqueid= null;
   var $published= 0;
   var $title=null;

// The constructor is called by the instantiation
   function __construct( &$database ) {
   parent::__construct( '#__chrono_comments', 'id', $database );

I tried to change << title >> by << mytitle >> in all the code, but this has changed nothing. I thought << title >> might be a reserved word.

Please, answer me. I want to know your opinion.


I have found !

Now I can look for traduction.


i don't think it's a good function for Chrone Comment, because people just want to make a comment for the article not make a new idea for article. Wordpress is a great example, It have very great comment system with askiment, fontend public, email notify ...

i think Max want to make Chrono Comment look like worpdress comment system, so he's did not pay attention for your hack.

Any way thank for a good tips.