Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: Add jcomment to Mini frontpage?
Pages: [1]   Go Down
  Print  
Author Topic: Add jcomment to Mini frontpage?  (Read 9154 times)
0 Members and 1 Guest are viewing this topic.
luftkaffe
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« on: December 12, 2010, 00:03:17 »

is it possible? It would be a great extension if i just get the commentlink to work.
I´ve read the Developers guide, but i´m afraid i dont understand it wery well.


Here are the code for /tmpl/default.php

Code:
<?php 

// no direct access 

defined('_JEXEC') or die('Restricted access'); 



$database =& JFactory::getDBO(); 

$pwidth intval(100/$columns); 

$col 0

  

$ini_intro 1

?>
<table width="100%" class="minifp"><?php 



foreach ( $rows as $row ) { 

// ----------- add category title ------------ 

$link JRoute::_($row->link); 

if (
$cat_title) { 

$query "SELECT title FROM #__categories WHERE id ="$row->catid

$database->setQuery$query ); 

$categ $database->loadResult(); 

$catlink   JRoute::_(ContentHelperRoute::getCategoryRoute($row->catslug$row->sectionid));

}

 

if (
$show_title) { 

$title '<a href="'$link .'">'$row->title '</a>'

}
else {

$title '<a href="'$link .'">'$row->title '</a>'

}

 

if ( 
$num_intro ) { 

if ($col==0) { ?>
<tr><?php }?>






<td valign="top" width="<?php echo $pwidth?>%" class="minifp"><?php 

if ($loadorder == 1) {

showThumb($row->images,$row->image,$params,$link); 



if ($cat_title) {

echo '<span class="'.$class_categoria.'">';

if($cat_title_link) {

echo '<a href="'.$catlink.'">';

}

echo $categ;

if($cat_title_link) {

echo '</a>';

}

echo '</span>';

}



if ($show_title) { 

if ($title_link == 1) {

echo '<span class="'.$class_introtitle.'">'.$title.'</span>';

} else { 

echo '<span class="'.$class_introtitle.'">'$row->title '</span>';

}



echo "<br class=\"minifp-seperator\" />"





if ($show_date) { 

echo '<span class="'.$class_date.'">'

switch($params->get'date_type' )) {

case 1:

$date = ($row->modified != "0000-00-00 00:00") ? $row->modified $row->created;

break;

case 2:

$date $row->publish_up;

break;

case 0:

default:

$date $row->created;

break;

}

echo JHTML::_('date'$date$params->get'date_format' ), $mainframe->getCfg('offset')); 

echo '</span>'



if($show_author_type) {

$author htmlspecialchars$row->username );

} else {

if ( $row->created_by_alias ) {

$author $row->created_by_alias;

} else {

$author htmlspecialchars$row->name );




}



if ($show_date && $show_author) { 

echo $sep





if ($show_author==1) { 

echo '<span class="'.$class_author.'">'.$author.'</span>'



echo '<br class="minifp-seperator" />'




if ($loadorder == 0) { 

// repeat code I hate this --- just because I can't create a new function -- damned 

if ($thumb_embed == 1) { 

?>
<a href="<?php echo $link?>"><?php 

if (!empty($row->images)) { 

$img strtok($row->images,"|\r\n"); 

$class=""

$extra ' align="left" alt="article thumbnail" ';  

fptn_thumb_size($img$thumb_width$thumb_height$image$extra$class$aspect); 

echo $image

} else if ($row->image !="") {

$img strtok($row->images,"|\r\n"); 

$class=""

$extra ' align="left" alt="article thumbnail" ';  

fptn_thumb_size($img$thumb_width$thumb_height$image$extra$class$aspect); 

echo $image

} else {

if($thumb_embed_default) {

$img ""

$class=""

$extra ' align="left" alt="article thumbnail" '

fptn_thumb_size($img$thumb_width$thumb_height$image$extra$class$aspect); 

echo $image;

}

}

}

?>
</a><?php 

}// end if ($loadorder == 0) 

if ( ($limit 1) ) { 

echo $row->introtext

?>
<br class="minifp-seperator" /><?php 

} else { 

?>
<div style="clear: both;"></div><?php 



if ($fulllink !="") { 

?>


<div class="minifp-full-link-wrp"><a class="minifp-full-link" href="<?php echo $link?>"><?php echo $fulllink?></a></div><?php 



?>
</td>

<?php 



$num_intro $num_intro 1



if ( $num_intro == ) { 

$ini_intro 0

if ( ( ( ($col 1) % $columns ) == ) && $anotherlink ) echo "</tr><tr>"

if ( ( ( ($col 1) % $columns ) == ) && !$anotherlink ) echo "</tr>"

if ($anotherlink) { 

echo '<td valign="top" colspan="'.$columns.'">'

if ($header_title_links != "") echo "<span class='".$class_another_links."'>".$header_title_links."</span>"

else echo "<br class=\"minifp-seperator\" />"

echo '<ul class="minifp">'

}



} else if ( ($num_intro==0) && ($ini_intro == 1) ) {

if ( ( ($col 1) % $columns ) == ) echo "</tr><tr>"

echo '<td valign="top" colspan="'.$columns.'">'

if ($header_title_links != "") echo "<span class='".$class_another_links."'>".$header_title_links."</span>"

else echo "<br class=\"minifp-seperator\"/>"

echo '<ul class="minifp">'

echo "<li class='minifp'>"$title ."</li>"

$ini_intro 0

continue; 

} else { 

echo "<li class='minifp'>"$title ."</li>"



$col = ($col 1) % $columns

if ($col == && $num_intro) echo "</tr>"





if ( (
$num_intro==0) && $anotherlink) {

?>
</ul></td></tr><?php





echo 
'</table>';



?>

Logged
joshlfisher
Newbie
*

Karma: 0
Offline Offline

Posts: 2


Email
« Reply #1 on: January 28, 2011, 08:01:24 »

I REALLY need help with this one too!

It doesn't need a plugin, since the content plugin covers all the info needed by this module.

Here is the code I added:

Code:
|  <a href="<?php echo $item->articleLink?>#addcomments"><?php $comments JPATH_SITE DS .'components' DS 'com_jcomments' DS 'jcomments.php';
  if (
file_exists($comments)) {
    require_once(
$comments);
    
$count JComments::getCommentsCount($id'com_content');
    echo 
$count ? ('Comments('$count ')') : 'Add comment';
  }
  
?>
</a>

add this code wherever you want the 'Add Comments' link, or the 'Comments (3)' link to show.

NOTE:  This code does not work completely. I still need to replace $id with the correct code to pull the article id.

Can someone tell me where this code is that creates the comments link for items like the frontpage, or any blog layout pages?
« Last Edit: January 28, 2011, 09:21:20 by joshlfisher » Logged
smart
Administrator
Hero Member
*****

Karma: 188
Offline Offline

Gender: Male
Posts: 1883



WWW
« Reply #2 on: February 01, 2011, 17:50:22 »

that creates the comments link for items like the frontpage, or any blog layout pages?
You can find it in JComments content plugin (/plugins/content/jcomments.php).
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
joshlfisher
Newbie
*

Karma: 0
Offline Offline

Posts: 2


Email
« Reply #3 on: February 01, 2011, 21:44:59 »

I think maybe the best solution is to post some generic code that will allow the insertion on the comments link into modules that utilize com_content.

Can you help with that, Smart?
Logged
smart
Administrator
Hero Member
*****

Karma: 188
Offline Offline

Gender: Male
Posts: 1883



WWW
« Reply #4 on: February 01, 2011, 22:08:23 »

Simple code:
Code: (php)
include_once (JPATH_ROOT.DS.'components'.DS.'com_jcomments'.DS.'jcomments.legacy.php');
require_once (JCOMMENTS_BASE.DS.'jcomments.config.php');
require_once (JCOMMENTS_BASE.DS.'jcomments.class.php');

$user = & JFactory::getUser();

if ($article->access <= $user->get('aid', 0)) {
$readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid));
$readmore_register = 0;
} else {
$readmore_link = JRoute::_('index.php?option=com_user&task=register');
$readmore_register = 1;
}

// load template for comments & readmore links
$tmpl = & JCommentsFactory::getTemplate($article->id, 'com_content', false);
$tmpl->load('tpl_links');

$tmpl->addVar('tpl_links', 'comments_link_style', ($readmore_register ? -1 : 1));
$tmpl->addVar('tpl_links', 'content-item', $article);
$tmpl->addVar('tpl_links', 'link-comment', $readmore_link);

$readmore_text = JText::_('Read more...');
$tmpl->addVar('tpl_links', 'link-readmore', $readmore_link);
$tmpl->addVar('tpl_links', 'link-readmore-text', $readmore_text);
$tmpl->addVar('tpl_links', 'link-readmore-title', $article->title);

require_once (JCOMMENTS_BASE.DS.'model'.DS.'jcomments.php');
$count = JCommentsModel::getCommentsCount($article->id, 'com_content');
$tmpl->addVar('tpl_links', 'comments-count', $count);

echo $tmpl->renderTemplate('tpl_links') . $article->text;

The $article variable must be an article object (JTableContent)
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: Add jcomment to Mini frontpage?
 
Jump to: