Keyword

[SOLVED] K2 facebook comments

  • Chrysanthos
  • Chrysanthos's Avatar Topic Author
  • Offline
  • New Member
More
11 years 9 months ago - 11 years 9 months ago #117113 by Chrysanthos
[SOLVED] K2 facebook comments was created by Chrysanthos
hi,
what facebook comment extension do you use here? getk2.org/about
Thanks in advance

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

More
11 years 8 months ago - 11 years 8 months ago #117114 by VietPublic
Replied by VietPublic on topic Re: K2 facebook comments
Overide your template ex
Copy ROOT\components\com_k2 to
ROOT\templates\YOUR_TEMPLATE\html\ (create html folder if not exist)
Edit
ROOT\templates\YOUR_TEMPLATE\html\com_k2\templates\default\item.php
After line 673 (before K2_BACK_TO_TOP code) add code
  <!-- Facebook Comments -->
<?php if($this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)): ?> 

        <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> 

<?php endif; ?>

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

More
11 years 7 months ago #117115 by Mariak Bol
Replied by Mariak Bol on topic Re: K2 facebook comments
Hi, I have tried to follow the procedures to override but still doesn't give me Facebook comments in my Joomla 3 K2 articles. Please explain little more, Thanks

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 7 months ago #117116 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: K2 facebook comments
Have you read the documentation in Facebook developers? Have you created a Facebook App?

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

More
11 years 7 months ago #117117 by Mariak Bol
Replied by Mariak Bol on topic Re: K2 facebook comments
Yes i have created Facebook App. Where shoud I paste or add the App ID in the code?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 7 months ago #117118 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: K2 facebook comments
Yes, Also check with the developers.facebook.com site if the code has changed in anyway

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

More
11 years 7 months ago #117119 by Corneliu Ciornei
Replied by Corneliu Ciornei on topic Re: K2 facebook comments
hi,
i have 2 questions...

1.where i have to add api code
2.when i'm inserting the code for facebook comments, will appear both block for comments

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 7 months ago #117120 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: K2 facebook comments
In your item.php (you should override it, if your template doesn't have one)

This tutorial will explain overriding: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

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

More
11 years 4 months ago #117121 by tai
Replied by tai on topic Re: K2 facebook comments

VietPublic wrote: Overide your template ex
Copy ROOT\components\com_k2 to
ROOT\templates\YOUR_TEMPLATE\html\ (create html folder if not exist)
Edit
ROOT\templates\YOUR_TEMPLATE\html\com_k2\templates\default\item.php
After line 673 (before K2_BACK_TO_TOP code) add code

  <!-- Facebook Comments -->
<?php if($this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)): ?> 

        <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> 

<?php endif; ?>


Awesome, it worked, I love you so much !!!!!

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

More
11 years 3 months ago #117122 by Radu Nefton
Replied by Radu Nefton on topic Re: K2 facebook comments
hi all .
What changes to this code i have to make so only the facebook comment box shows.
I followed the steps in this topic and both boxes k2 & facebook appears . If i disable the k2 comment it's disappear both of them . Can anyone help me please. :(

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 3 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
11 years 3 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
11 years 3 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
11 years 3 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
11 years 3 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
11 years 3 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
11 years 3 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
11 years 3 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
11 years 3 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
11 years 3 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