Integration of JComments to Tutorials
|
Tutorials is a Communication Joomla Component. User can submit on this Component him/her item or news or article or tutorial etc, also there user can post comment on this submitted item. Also user can add +fav on fav list.
- Open file /components/com_tutorials/tutorials.html.php
- Find the lines:
<?php HTML_tutorials::showComment( $row, $params ); ?>
and replace with:
<?php
global $mainframe;
$jcomments = $mainframe->getCfg('absolute_path') . '/components/com_jcomments/jcomments.php';
if (file_exists($jcomments)) {
require_once($jcomments);
$obj_id = $row->id;
$obj_title = $row->title;
echo JComments::showComments($obj_id, 'com_tutorials', $obj_title);
}
?>
- Find the lines:
//get comments count
$query = "SELECT count(*)"
. "\n FROM #__tutorials_comments AS c"
. "\n WHERE c.tutorialid = " . (int) $row->id
. "\n AND c.published = 1"
;
$database->setQuery( $query );
$row->comments = $database->loadResult();
and replace with:
global $mainframe;
$jcomments = $mainframe->getCfg('absolute_path') . '/components/com_jcomments/jcomments.php';
if (file_exists($jcomments)) {
require_once($jcomments);
$row->comments = JComments::getCommentsCount($row->id, 'com_tutorials');
}
See also:
|