如何在ASP.NET MVC实现Disqus? [英] How do I implement Disqus in ASP.NET MVC?

查看:70
本文介绍了如何在ASP.NET MVC实现Disqus?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在指定构建中部/购买权衡了公众网站上,都创下了相当有趣的途径。

I'm in the middle of specifying the build/buy trade-offs for a public website and have hit a rather interesting avenue.

该网站的设计部分是将评论与一组不同的物品这显然有自己的IDSS的。 (即/食谱/ 23或设备/ 16等,等)。

Part of the design of the website is to incorporate comments against a set of different 'items' which obviously have their own IDss. (i.e. /recipes/23 or equipment/16 etc, etc).

起初,我曾与指定标记的评论系统。然而,项目发起人已经回来了,问它会很容易合并Disqus到组合。我用这个之前与Joomla(从来没有在.NET),并认为这将是一个伟大的想法的意见是通过平时的社交网络媒体在默认情况下自动distrubuted。

Initially, i had specified a comments system with tags. However, the project sponsor has come back and asked if it would be easy to incorporate Disqus into the mix. I've used this before with Joomla (never in .NET) and think that it'll be a great idea as the comments are automatically distrubuted via the usual social network mediums by default.

它是相当容易建立Disqus对ASP.NET MVC的实现,无缝工作?有没有在ASP.NET MVC工作Disqus解决方案的教程或例子吗?我见过<一个href=\"http://www.graytechnology.com/Blog/post/Integrate-Disqus-into-your-site-using-JavaScript.aspx\">this例如并有阅读文档为止。

Is it fairly painless to set up an implementation of Disqus on ASP.NET MVC that works seamlessly? Are there tutorials or examples of a working Disqus solution in ASP.NET MVC? I've seen this example and have read the documentation so far.

推荐答案

我选择使用异步的JavaScript load方法(而不是使用盛开的睡API方法)。这里是如何简单,它是ASPNET MVC(这也适用于ASP.NET)使用此:

I'm electing to use the async JavaScript load approach (as opposed to using the fullblown API methods). here's how simple it is using this in ASPNET MVC (It also works for ASP.NET):

文档:

<!-- add the div to receive the comments via ajax -->
<div id="disqus_thread"></div>

<!-- the required javascript link to disqus -->
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'mydisqusname';

    // Question pour XWiki : ici il faut que je configure un identifier
    // c'est comme un sujet de Mail. Il faudrait que je mette par exemple
    // l'url de la page XWiki afin que les commentaires soient regroupes

    // ensemble par article. Bref est ce que vous pouvez me mettre un ID ?

    var disqus_identifier = 'comments-league-<%= Html.Encode(Model.ID) %>';
    var disqus_url = '<%= HttpContext.Current.Request.Url %>';
    // using disqus_developer = 1 helps to debug to localhost etc..
    var disqus_developer = 1;


    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';

        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>

这是所有有给它。

这篇关于如何在ASP.NET MVC实现Disqus?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆