heimrichhannot/contao-disqus-bundle

Contao 4 disqus 组件包

2.3.0 2022-10-11 10:35 UTC

This package is auto-updated.

Last update: 2024-09-11 14:58:43 UTC


README

Build Status Coverage Status

将 disqus 评论系统添加到您的 Contao 页面。

功能

  • 集成到新闻文章渲染
  • 独立模块,可集成到您想要的任何地方
  • 更多自定义位置的服務

要求

  • Contao 4.4
  • PHP 7

安装

composer require heimrichhannot/contao-disqus-bundle

设置

有三种方式集成 disqus。

新闻

  • 在您的新闻模板(通常为 news_full.html5)中,添加以下代码
<?php if ($this->disqus_section): ?>
    <?php $this->disqus_section ?>
<?php endif; ?>
  • 在您的新闻存档中,激活 disqus 评论并输入 disqus 论坛名称

模块

  • 创建一个模块,包含捆绑的 disqus 评论模块,并输入所有必要信息
  • 将模块添加到文章中

服务

  • 输出 DisqusRenderer::render() 的结果(可从 huh.disqus.renderer 服务调用)
// Example from DisqusCommentModule (we recommend injecting the service instead of calling it direct from container):

$this->Template->disqus_block = System::getContainer()->get('huh.disqus.renderer')->render($this->disqus_shortname, $this->disqus_identifier);