Keyword

Commenting on K2 blog using only social account

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 4 months ago #113418 by Yiota
Actually is Madam,

Your code should look like this
<?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="http://example.com" data-width="470" data-num-posts="10"></div>

<?php endif; ?>

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

  • Filip Nikitovic
  • Filip Nikitovic's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 4 months ago #113419 by Filip Nikitovic
Replied by Filip Nikitovic on topic Re: Commenting on K2 blog using only social account
So it was madam all the time :)
Thank You very much for your time.

Im losing my had here.

You told me to "comment out all elements inside that if statement (or erase them) and paste your facebook code there"

So why does code still have elements that You told me to erase.
Should I erase them like this.
<?php if; ?>

<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="http://example.com" data-width="470" data-num-posts="10"></div>
 
<?php endif; ?>

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 4 months ago #113420 by Yiota
Since you are working on the override file inside your template and not the K2 core file you could just replace the existing comments code with the one I sent you.

Note that you will have to customize the facebook comments code to suit your needs. This is a default code snippet.

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

  • Filip Nikitovic
  • Filip Nikitovic's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 4 months ago - 11 years 4 months ago #113421 by Filip Nikitovic
Replied by Filip Nikitovic on topic Re: Commenting on K2 blog using only social account
Please,please ,Im sorry to bore You so how does code look like exactly at the end?

I will customize it so suit my needs.

Do I have to add only this:
<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="http://example.com" data-width="470" data-num-posts="10"></div>
 
<?php endif; ?>

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

becouse when I do that nothing happens

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 4 months ago #113422 by Yiota
Yes. And of course enable the comments because that if statement checks if the option of K2 comments is enabled.

You could also replace the
<?php if($this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)): ?>

with
<?php if($this->item->params->get('itemComments')): ?>

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

  • Filip Nikitovic
  • Filip Nikitovic's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 4 months ago #113423 by Filip Nikitovic
Replied by Filip Nikitovic on topic Re: Commenting on K2 blog using only social account
Cooments are enabled.

When I edit code like this and try to open item i get white page,no error no nothing

<?php if($this->item->params->get('itemComments')): ?>

<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="http://example.com" data-width="470" data-num-posts="10"></div>
 
<?php endif; ?>

Mybe problem is becouse I use example.com or becouse Im working on localhost

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

  • Filip Nikitovic
  • Filip Nikitovic's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 4 months ago #113424 by Filip Nikitovic
Replied by Filip Nikitovic on topic Re: Commenting on K2 blog using only social account
It simply doesnt work like this.
I tried same thing on my website,not just localhost.

I edited code just as You instructed
<?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/de_DE/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-comments" data-href="http://www.vienna-airport-cab.at/" data-width="470" data-num-posts="10"></div>

<?php endif; ?> 
 <!-- Item comments -->

In category "view" everything is ok but when I try to open "item" page I can only see white screen and nothing else.

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

  • Filip Nikitovic
  • Filip Nikitovic's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 4 months ago #113425 by Filip Nikitovic
Replied by Filip Nikitovic on topic Re: Commenting on K2 blog using only social account
I also tried replacing
<?php if($this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)): ?>

with
<?php if($this->item->params->get('itemComments')): ?>

And still nothing,just white screen...

Please heeelp meee,Im so frustrated

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 4 months ago #113426 by Yiota
Sent me your item.php file to check it out.

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

  • Filip Nikitovic
  • Filip Nikitovic's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 4 months ago - 11 years 4 months ago #113427 by Filip Nikitovic
Replied by Filip Nikitovic on topic Re: Commenting on K2 blog using only social account
Thank You.


Attachment not found

Attachments:

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


Powered by Kunena Forum