- Posts: 73
COMMUNITY FORUM
Commenting on K2 blog using only social account
- Yiota
-
- Visitor
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
-
Topic Author
- Offline
- Senior Member
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
-
- Visitor
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
-
Topic Author
- Offline
- Senior Member
- Posts: 73
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
-
- Visitor
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
-
Topic Author
- Offline
- Senior Member
- Posts: 73
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
-
Topic Author
- Offline
- Senior Member
- Posts: 73
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
-
Topic Author
- Offline
- Senior Member
- Posts: 73
<?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
-
- Visitor
Please Log in or Create an account to join the conversation.
- Filip Nikitovic
-
Topic Author
- Offline
- Senior Member
- Posts: 73
Attachment not found
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Attachment not found
Please Log in or Create an account to join the conversation.
- Filip Nikitovic
-
Topic Author
- Offline
- Senior Member
- Posts: 73
Thank You for trying to help.
When I use four item.php I do get facebook comment box at the end of page.
I can comment using my facebook account but when i refresh page comment disapear but I can see that comment on my facebook profile.
So I tryed commenting using Yahoo account and refreshing page, and comment stay on page but when I click on pen icon at the right top side of comment box (where edit and delete options are)
Attachment not found
and I click on edit and facebook login box is showed,see bellow
Attachment not found
but comment is made with Yahoo and Im still loged in Yahoo(if that is important for You to know).
Another problem is when I click on pen icon at the right top side of comment box and click delete that comment made with Yahoo,I get facebook message,like on this image
Attachment not found
Its importand to know that at this point Im loged out of Facebook,Yahoo and Joomla and still I can delete comment so if I can delete it the I belive anyone can delete comments on my page.
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
<div class="fb-comments" data-href="<?php echo $this->item->link; ?>" data-width="470" data-num-posts="10"></div>
Please Log in or Create an account to join the conversation.
- Filip Nikitovic
-
Topic Author
- Offline
- Senior Member
- Posts: 73
<a name="itemCommentsAnchor" id="itemCommentsAnchor"></a>
<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; ?>
<?php if(!JRequest::getCmd('print')): ?>
<div class="itemBackToTop">
<a class="k2Anchor" href="<?php echo $this->item->link; ?>#startOfPageId<?php echo JRequest::getInt('id'); ?>">
<?php echo JText::_('K2_BACK_TO_TOP'); ?>
</a>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
<div class="fb-comments" data-href="<?php echo $this->item->absoluteURL; ?>" data-width="470" data-num-posts="10"></div>
Please, if you are not familiar with php you should consider hiring someone that does.
Please Log in or Create an account to join the conversation.
- Filip Nikitovic
-
Topic Author
- Offline
- Senior Member
- Posts: 73
<!-- Item comments -->
<a name="itemCommentsAnchor" id="itemCommentsAnchor"></a>
<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="<?php echo $this->item->absoluteURL; ?>" data-width="470" data-num-posts="10"></div>
<?php endif; ?>
And now when I click on comment nothing happens.
Please, if you are not familiar with php you should consider hiring someone that does
Well Ive done everything You said to do, and Yes I asked You to be direct when explaining and I appreciate that very much.
I gave up on using facebook as comment box few days ago but I continued on trying and doing everything You say becouse of other users,mybe this can help someone in future, and becouse I respect You and Your time trying to help me.
For more complicated stuff I would have to hire php professional.
Regards,
Filip Nikitovic
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Anyhow. I tried the code myself and the facebook comments mechanism is working just fine. Would you like to resent me your item.php page to test it as well?
Please Log in or Create an account to join the conversation.
- Filip Nikitovic
-
Topic Author
- Offline
- Senior Member
- Posts: 73
No problem, everything is cool.
I cant afford that at this moment.There is nothing wrong with consulting a more experienced developer to solve your problem.
I read somewhere that K2 wont work with some templates.Anyhow. I tried the code myself and the facebook comments mechanism is working just fine.
Im using Kotoba template by Joomla Direct.
Im testing everything on localhost becouse my site www.vienna-airport-cab.at/Would you like to resent me your item.php page to test it as well?
is for taxi company and we have our cutomers using order form everyday so if something go wrong on localhost there is no damage.
Please Log in or Create an account to join the conversation.