Click here to link... here on last right collumn there is info about last comment.
I am working on custom forum template. Forum tempalte from package has difficult structure for me so I used cobalt7 template for category index and edited it. It is almost ready but as this template by default is not dedicated for forum it does not have block for display last comments so I opened forum template and added this two codes to my template:
This one to place where I want to display that info.
<?php if($cat->comments_num):?>
<?php echo lastCatComemnt($cat->id, $obj->section);?>
<?php else:?>
and this one at the end of file
<?php
function lastCatComemnt($id, $section)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('c.user_id, c.ctime, c.record_id');
$query->from('#__js_res_comments AS c');
$query->select('r.title');
$query->leftJoin('#__js_res_record AS r ON r.id = c.record_id');
$query->where('c.published = 1');
$query->order('c.ctime DESC');
$query->where('c.record_id IN(SELECT record_id FROM #__js_res_record_category WHERE catid = '.$id.')');
$db->setQuery($query, 0, 1);
$row = $db->loadObject();
$patern = '<div><a href="/%s">%s</a></div><small>%s On %s</small>';
return sprintf($patern, JRoute::_(Url::record($row->record_id, $section)), $row->title, CCommunityHelper::getName($row->user_id, $section), JHtml::_('date', $row->ctime, 'd M Y'));
}
I just copied this codes from forum template, but I am jsut missing something, because I can only display username(not linkable) and date. There is not title for record which has last comment. Click here to link... check second subcategory with light bulb icon. on right there is my name and date only.
Can someone tell me what I am missing?
Click here to link... here on last right collumn there is info about last comment.
I am working on custom forum template. Forum tempalte from package has difficult structure for me so I used cobalt7 template for category index and edited it. It is almost ready but as this template by default is not dedicated for forum it does not have block for display last comments so I opened forum template and added this two codes to my template: This one to place where I want to display that info.
and this one at the end of file
I just copied this codes from forum template, but I am jsut missing something, because I can only display username(not linkable) and date. There is not title for record which has last comment. Click here to link... check second subcategory with light bulb icon. on right there is my name and date only.
Can someone tell me what I am missing?