English 中文(简体)
书本评论——每页的相同评论
原标题:Facebook comments plugin - same comments on every page

Facebook comments on my website work well except the fact when someone comments on one article that same comment shows up on every article on the website. Obviously, I don t want that. What I did is basically copy and paste code offered on developers.facebook.com:

      `<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-num-posts="2" data-                                      width="470"></div>`

我有什么错误? 我感谢任何帮助。

Vio

问题回答

页: 1

你们要么提供你职位上的URL,要么把这一名词空出(如果这一称谓缺失或空洞的话,现在的URL就用在每页评论社会假想。

我也存在同样的问题,尝试了“礼仪”提供的解决办法,我得到“评论片需要一种红利参数”。 然后,我发现,如果你使用 X子的XFBML版本,就应当解决黄麻问题。

不管怎样,我在静态的网址上实施的解决办法是将href/URL与本法典合并。

    <?php echo( http:// .$_SERVER[ HTTP_HOST ].$_SERVER[ REQUEST_URI ]); ?>

Don t use the fundamental url for the data-href. 你们需要动态地为每一页创造午餐。 例如,如果是语言压力博客的话,你将使用《加拿大法典》data-href='<?php呼应(get_permalink()?>

这将奏效,但我发现,在一个地点,我无法使用购买力平价。 因此,这对我来说是一种 j子解决办法。 简单地用这一javascript代码取代评论......

<script>document.write("<div class= fb-comments  data-href= " + window.location.href + "  data-num-posts= 2  data-width= 470 ></div>");</script>

引证:

参考; 分类=“fb-comments”prr.href=数据:邮政数据-width=“600”数据-numposts=“5”数据-colorscheme=“light”>

注:

在上述两行之间,没有空间。

沿用上述法典

class= post-footer-line post-footer-line-3

Check in: http://debaonline4u.blogspot.com

I put the page url after the domain and it s work for me. MyDomain is the domain I out when I create the code on the Facebook comments.

<div class="fb-comments" data-href="http://MyDomain/Mypage URL" data-numposts="5" data-colorscheme="light"></div>

The problem is data-href.

而是使用动态的URL。

For eg. 如果你要求“Facebook”单独对每一页发表评论。

PHP :

data-href="<?php echo  http:// . $_SERVER[ SERVER_NAME ] . $_SERVER[ REQUEST_URI ]; ?>"

希望能帮助他人。

由于需要将关切分离......

例如,如果你有网页www.example/123.com,那么,你的数据价值必须是www.example/123.com。

For doing this means is that render and store comments for www.example/123.com and it will not then appear on other pages....

www.un.org/Depts/DGACM/index_spanish.htm 用于PHP Laravel。

$currentURL = URL::current();//get currnt url
<div class="comment-form-area">
                        <div class="sharethis-inline-reaction-buttons"></div>
                        <div class="fb-comments" data-href="{{$currentURL}}" data-width="700" data-numposts="5">
                        </div>
                    </div>

<>如果你在Laravel Blade Templates中使用,

@php $currentURL = URL::current(); @endphp
<div class="comment-form-area">
                        <div class="sharethis-inline-reaction-buttons"></div>
                        <div class="fb-comments" data-href="{{$currentURL}}" data-width="700" data-numposts="5">
                        </div>
                    </div>




相关问题
VS 10 mangles html comments?

Using the latest VS 10 we created html markup, then commented it with html comments. The file on disk is not mangled, but when it renders, it renders the html comment tags, then removes some of the ...

Comments & OpenSource software [closed]

This may sound like a foolish question or an observation, but i have seen that most of the times when one tries to look at the opensource code, there are no comments or just one or two lines at the ...

Including commented Class declaration in implementation file

Everyone knows the advantages of a more readable code. So in order to make my code more readable what i do normally is include the commented class declaration in the implementation file of that class....

pair programming with comments [closed]

Over the years, I ve discovered that green-programmers tend to read the comments rather than the code to debug issues. Does having one person document the other person s code (and vice-versa) with ...

Commenting JavaScript functions á la Python Docstrings

It is valid JavaScript to write something like this: function example(x) { "Here is a short doc what I do."; // code of the function } The string actually does nothing. Is there any reason, ...

热门标签