Keyword

[SOLVED] K2 facebook comments

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 7 months ago #117123 by Yiota
Replied by Yiota on topic Re: K2 facebook comments
Make sure that in your item.php file under comments block all you see it the code provided below and nothing else.

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #117124 by Radu Nefton
Replied by Radu Nefton on topic Re: K2 facebook comments
I moved the block of code from line 673 to the bottom of the file and stil not working . Nothing changed .
I have atached the item.php to this post can you look at the file and tell me what i`m doing wrong .

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 7 months ago #117125 by Yiota
Replied by Yiota on topic Re: K2 facebook comments
I don't see the attachment can you try again or paste the code directly in the editor by using the code tags?

Thank you.

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #117126 by Radu Nefton
Replied by Radu Nefton on topic Re: K2 facebook comments

Attachment not found


I changed the exension of the file to .txt
Attachments:

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 7 months ago #117127 by Yiota
Replied by Yiota on topic Re: K2 facebook comments
You need to replace this code
<div class="itemComments">

	  <?php if($this->item->params->get('commentsFormPosition')=='above' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
	  <!-- Item comments form -->
	  <div class="itemCommentsForm">
	  	<?php echo $this->loadTemplate('comments_form'); ?>
	  </div>
	  <?php endif; ?>

	  <?php if($this->item->numOfComments>0 && $this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2'))): ?>
	  <!-- Item user comments -->
	  <h3 class="itemCommentsCounter">
	  	<span><?php echo $this->item->numOfComments; ?></span> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
	  </h3>

	  <ul class="itemCommentsList">
	    <?php foreach ($this->item->comments as $key=>$comment): ?>
	    <li class="<?php echo ($key%2) ? "odd" : "even"; echo (!$this->item->created_by_alias && $comment->userID==$this->item->created_by) ? " authorResponse" : ""; echo($comment->published) ? '':' unpublishedComment'; ?>">

	    	<span class="commentLink">
		    	<a href="<?php echo $this->item->link; ?>#comment<?php echo $comment->id; ?>" name="comment<?php echo $comment->id; ?>" id="comment<?php echo $comment->id; ?>">
		    		<?php echo JText::_('K2_COMMENT_LINK'); ?>
		    	</a>
		    </span>

				<?php if($comment->userImage): ?>
				<img src="<?php echo $comment->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($comment->userName); ?>" width="<?php echo $this->item->params->get('commenterImgWidth'); ?>" />
				<?php endif; ?>

				<span class="commentDate">
		    	<?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?>
		    </span>

		    <span class="commentAuthorName">
			    <?php echo JText::_('K2_POSTED_BY'); ?>
			    <?php if(!empty($comment->userLink)): ?>
			    <a href="<?php echo JFilterOutput::cleanText($comment->userLink); ?>" title="<?php echo JFilterOutput::cleanText($comment->userName); ?>" target="_blank" rel="nofollow">
			    	<?php echo $comment->userName; ?>
			    </a>
			    <?php else: ?>
			    <?php echo $comment->userName; ?>
			    <?php endif; ?>
		    </span>

		    <p><?php echo $comment->commentText; ?></p>

				<?php if($this->inlineCommentsModeration || ($comment->published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest)))): ?>
				<span class="commentToolbar">
					<?php if($this->inlineCommentsModeration): ?>
					<?php if(!$comment->published): ?>
					<a class="commentApproveLink" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=publish&commentID='.$comment->id.'&format=raw')?>"><?php echo JText::_('K2_APPROVE')?></a>
					<?php endif; ?>

					<a class="commentRemoveLink" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=remove&commentID='.$comment->id.'&format=raw')?>"><?php echo JText::_('K2_REMOVE')?></a>
					<?php endif; ?>

					<?php if($comment->published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest))): ?>
					<a class="modal" rel="{handler:'iframe',size:{x:560,y:480}}" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=report&commentID='.$comment->id)?>"><?php echo JText::_('K2_REPORT')?></a>
					<?php endif; ?>

					<?php if($comment->reportUserLink): ?>
					<a class="k2ReportUserButton" href="<?php echo $comment->reportUserLink; ?>"><?php echo JText::_('K2_FLAG_AS_SPAMMER'); ?></a>
					<?php endif; ?>

				</span>
				<?php endif; ?>

				<div class="clr"></div>
	    </li>
	    <?php endforeach; ?>
	  </ul>

	  <div class="itemCommentsPagination">
	  	<?php echo $this->pagination->getPagesLinks(); ?>
	  	<div class="clr"></div>
	  </div>
		<?php endif; ?>

		<?php if($this->item->params->get('commentsFormPosition')=='below' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
	  <!-- Item comments form -->
	  <div class="itemCommentsForm">
	  	<?php echo $this->loadTemplate('comments_form'); ?>
	  </div>
	  <?php endif; ?>

	  <?php $user = JFactory::getUser(); if ($this->item->params->get('comments') == '2' && $user->guest): ?>
	  		<div><?php echo JText::_('K2_LOGIN_TO_POST_COMMENTS'); ?></div>
	  <?php endif; ?>

  </div>

with this one:
<div id="fb-root"></div> 
        <script>(function(d, s, id) { 
                var js, fjs = d.getElementsByTagName(s)[0]; 
                if (d.getElementById(id)) return; 
                js = d.createElement(s); js.id = id; 
                js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; 
                fjs.parentNode.insertBefore(js, fjs); 
                }(document, 'script', 'facebook-jssdk'));
        </script> 
 
        <div class="fb-comments" data-href="<?php $url="".$this->item->absoluteURL; echo $url; ?>" data-width="500" data-num-posts="10"></div> 

not keep them both in your item.

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #117128 by Radu Nefton
Replied by Radu Nefton on topic Re: K2 facebook comments
:woohoo: It's working .
God bless you .
I want to ask you another thing , when i copied the com_k2 from root/componet to templates/my-template/html/com_k2/templates/default all the item style(view) has changed. How can i change this style back .

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 7 months ago #117129 by Yiota
Replied by Yiota on topic Re: K2 facebook comments
The path you should have in your template folder should be
templates/my-template/html/com_k2/default rather than templates/my-template/html/com_k2/templates/default
Try that and let me know.

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #117130 by Radu Nefton
Replied by Radu Nefton on topic Re: K2 facebook comments
I'm a little confused now . What folder do i need to move ? Or i need to dellete something and copy again . :unsure:

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #117131 by Radu Nefton
Replied by Radu Nefton on topic Re: K2 facebook comments
I have taken the folder default and the files.
generic.php
generic_search.php
index.html
profile.php
register.php

and moved them up one level .
But nothing chaged .

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 7 months ago #117132 by Yiota
Replied by Yiota on topic Re: K2 facebook comments
Your folder structure under com_k2 should be like

default (folder)
generic.php
generic_search.php
index.html
profile.php
register.php

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum