×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: 'write comment' link under 'read more' link in cat-blog view?

'write comment' link under 'read more' link in cat-blog view? 15 years 3 months ago #6488

  • carsten888
  • carsten888's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 46
  • Thank you received: 32
I'm trying to get the 'write a comment'-link underneath the 'read more' link under articles in category-blog view.

I'm using a template override (based on the Beez template) for com_content. It has this event position:
echo $this->item->event->afterDisplayContent;
I set in the config the position to 'onAfterDisplayContent'
but the link keeps outputting from this:
echo JFilterOutput::ampReplace($this->item->text);
So the link gets send along with the article-content output.

I have completely read compojoom.com/forum/10-newbies-area/205-display-after-content and all of the template-threads.

'write comment' link under 'read more' link in cat-blog view? 15 years 3 months ago #6493

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
What do you mean with this:

I set in the config the position to 'onAfterDisplayContent'
but the link keeps outputting from this:


Do you mean JOSCreturn::onAfterDisplayContent ?

'write comment' link under 'read more' link in cat-blog view? 15 years 3 months ago #6503

  • carsten888
  • carsten888's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 46
  • Thank you received: 32

Do you mean JOSCreturn::onAfterDisplayContent ?

no. I tried that but that does not output anything.

with the event 'onAfterDisplayContent' At least the comments are shown under the article in article view, and the link is shown under the article in category-blog view.

How to display the link to the comments under the 'read more' link?

'write comment' link under 'read more' link in cat-blog view? 15 years 2 months ago #6936

  • carsten888
  • carsten888's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 46
  • Thank you received: 32
I finally got it working in a big roundabout way.

I have a template override for com_content, so in category-blog view I simply added the link:
//comment-link is not outputted on 'afterDisplayContent' 
//so added link myself
echo $this->item->event->afterDisplayContent; 
 
	//link to comments
 
	//get db
	$db = JFactory::getDBO();
 
	//get number of comments
	$item_id = $this->item->id;
	$query = "SELECT id "
	."FROM jos_comment "
	."WHERE contentid = $item_id "	
	."AND published='1' "
	;
	$db->setQuery($query);
	$rows_comments = $db->loadObjectList();
	$number_comments = count($rows_comments);	
 
	echo '<p>';
	//if(defined($this->item->readmore_link)){
		//$read_more_url = $this->item->readmore_link;
	//}else{
		$read_more_url = 'index.php?option=com_content&view=article&id='.$this->item->id.':'.$this->item->alias.'&catid='.$this->item->catid.'&Itemid='.intval(JRequest::getVar('Itemid', ''));		
	//}
	echo '<a href="'.$read_more_url.'#JOSC_TOP">';
	echo '('.$number_comments.')';
	echo ' comment';
	if($number_comments!=1){
		echo 's';
	}
	echo '</a>';
	echo '</p>';

then to get the comments under the article in full article-view, I hacked the plugin code.
version:
4.0.0
file:
plugins/content/joscomment.php
line:
42
$mainframe->registerEvent(($joscbotfunc ? $joscbotfunc : 'onPrepareContent'), $joscplugin);
change to:
if(JRequest::getVar('view', '')=='article'){
 
		$mainframe->registerEvent('onAfterDisplayContent', 'pluginJosCommentJ15_UseReturn');
	}
	unset($joscommentconfig);

Everything works now. Wonderfull plugin! :laugh:
  • Page:
  • 1
Time to create page: 0.097 seconds