M
M
Maybe_V2016-06-10 15:31:56
JavaScript
Maybe_V, 2016-06-10 15:31:56

How to set up disqus comments?

How to properly set up disqus comments?
There is a code example like this:

<div id="disqus_thread"></div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'my-short-name'; // required: replace example with your forum shortname
    var disqus_identifier = '[*id*]';
    var disqus_title = '[*pagetitle*]';
    var disqus_url = '[(site_url)][~[*id*]~]';


    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

I can not figure it out when I change var disqus_shortname- it does not work!
I work with yii2and want to get the title I do:
var disqus_title = <?= $post->title?> ;(that is, the title of the post), similarly with id:
var disqus_identifier = <?= $post->id?>';(id of the post in the database)

What am I doing wrong ??
How can I set it up correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2016-06-10
@AloneCoder

Do you forget quotes for js variables?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question