1 adrian_alexander Nov 01, 2013 15:07
3 adrian_alexander Nov 08, 2013 15:23
It seems right now the only possibility is to copy and paste a code at the end of each article , in the HTML editor. For best results, after pasting the code just hit save/make public, without going back to the WYSIWYG view.
I found this useful way of adding the facebook comments yesterday and tried it successfully today.
https://developers.facebook.com/docs/plugins/comments/
Once you set the correct url, size of the comments case, theme (light or dark only), and number of shown comments click get code.
It does say to paste the first bigger code after the body tag, so I tried that in the css file of the skin with no result, therefore I pasted both codes at the end of each article.
We can paste both codes in a notepad and only change the "article link". These codes look pretty simple, maybe some coder who knows php could actually implement them in a plugin
<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="article link" data-colorscheme="light" data-numposts="10" data-width="550"></div>
4 tilqicom Nov 11, 2013 12:47
You dont have to add it to every post. simply open your _item.block.inc.php file in your skin, add the global $baseurl in order to use it in second code block
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
global $Item, $baseurl;
and insert
<div class="fbcommentt"><fb:comments href="<?php echo $baseurl; ?>index.php?p=<?php $Item->ID();?>" num_posts="4" width="280"></fb:comments></div>
Of course you'd have to have FB connect code below present in your <head> or preferrably before closing </body>.
Dont forget to change your appId
<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_GB/all.js#xfbml=1&appId=[b]yourappid[/b]";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
5 adrian_alexander Nov 11, 2013 13:11
ok so I'll insert the first code in that skin file, but where? at the end of the existing code?
and the second code, that's just it, I don't know where to put it....
I only saw the body tag in the style.css...
/* reset spacing */
*{margin:0;padding:0}
html,body{min-height:100%;}
body{background:#000 url(images/bg.png) repeat-x center bottom;font-size:13px;font-style:normal;color:#4e4e4e;}
here?
#page{background:transparent url(images/header2.png) no-repeat center top; position:relative}
/* (max. possible width is limited by design, 1735px) */
.page-content{max-width:1600px;min-width:780px;margin:0 auto;}
6 tilqicom Nov 11, 2013 13:16
it depends on your skin. Like i said, if your skin has an "_item_block.inc.php"
file, you are supposed to insert the first codeblock there, before the comments, or where you want it to appear.
The second codeblock is for initiating FB connect, you are supposed to insert that either in _html_header.inc
in your <head> or _html_footer.inc
before the closing </body> tag.
PS: if your skin doesnt have those mentioned files, you can simply copy them from parent /Skins
folder
7 adrian_alexander Nov 11, 2013 13:34
Ah yes the parent folder has those two , and I see the body tag opens in the header one and closes only in the second one
I'll try then in the footer, right before that tag.
Sorry I'm askin for kiddie directions, I'm just html dumb haha, I have very little clue how stuff work, lucky for me this forum exists.
Ty so much for the reply, I'll try that now and see how it works
8 adrian_alexander Nov 11, 2013 13:51
Parse error: syntax error, unexpected '<' in /home/th401/public_html/skins/mystique2/_item_block.inc.php on line 186
9 tilqicom Nov 11, 2013 13:56
The code starts with html, so you are supposed to exit php first and reopen it after like so:
?><div class="fbcommentt"><fb:comments href="<?php echo $baseurl; ?>index.php?p=<?php $Item->ID();?>" num_posts="4" width="280"></fb:comments></div><?php
@adrian_alexander wrote earlier:
Parse error: syntax error, unexpected '<' in /home/th401/public_html/skins/mystique2/_item_block.inc.php on line 186
10 adrian_alexander Nov 11, 2013 14:05
exit php first..... I have no idea what you're saying. I'm sorry I just ....
I copied the new code with the ?> and well.... it makes a space but shows nothing, it's invisible...
I even put it on 3 rows...
kill me now lol
11 tilqicom Nov 11, 2013 14:09
That blank space is probably a good sign, it means the comment box is trying to get displayed. If you added FB connect code properly, it should show up.
You changed your appId in the fb connect above right ? I edited the above post
@adrian_alexander wrote earlier:
exit php first..... I have no idea what you're saying. I'm sorry I just ....
I copied the new code with the ?> and well.... it makes a space but shows nothing, it's invisible...
I even put it on 3 rows...
kill me now lol
12 adrian_alexander Nov 11, 2013 14:11
No it doesn't show up.
It only shows up if I add it like this
<div class="fb-comments" data-href="http://www.adrian-alexander.com/blog1.php/televiziunea-de-contopisti" data-colorscheme="light" data-numposts="10" data-width="550"></div>
however , I have no idea how to replace the http so it always sticks to each article's url
13 adrian_alexander Nov 11, 2013 14:12
Is this what I should add instead of the http?
"<?php echo $baseurl; ?>index.php?p=<?php $Item->ID();?>"
P.S. apparently not ....
14 tilqicom Nov 11, 2013 14:49
yes you should replace the data href with data-href="<?php echo $baseurl; ?>index.php?p=<?php $Item->ID();?>"
15 adrian_alexander Nov 11, 2013 14:57
same issue, I replaced and nothing shows up.
If I place a normal url there it shows up but of course all comments only go to that specific url.
I reloaded the blog 10 times, with that data href it just won't show up.. :((((
16 tilqicom Nov 11, 2013 15:24
oops sorry my bad. you should call the global $baseurl
to use it. in item.block.inc.php, right after starting line, you should add $baseurl in the globals like so:
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
global $Item, $baseurl;
17 adrian_alexander Nov 11, 2013 17:07
ok I'm back was a bit away.
I am definitely php stupid but I finally got it lol. You are a genius, thanks a LOT for helping with this. So the conclusion is that baseurl call has to be placed in between the other stuff that are already in the skin item block php. Mine looks like this now:
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
global $Plugins, $Item, $baseurl, $Skin, $c, $tb, $pb;
And lower, just before the
// FEEDBACK (COMMENTS/TRACKBACKS) INCLUDED HERE
I put it like this (only way that works cause the style of the comment has to be defined as well)
?><div class="fb-comments" data-href="<?php echo $baseurl; ?>index.php?p=<?php $Item->ID();?>" data-colorscheme="light" data-numposts="10" data-width="550"></div><?php
So again ty ty ty so much , it works flawlessly now, I even tested by posting on facebook :)
Hi @adrian_alexander,
I guess we still do not have any plugin that integrates a different comment system. Maybe in the future.