heimrichhannot / contao-disqus-bundle
Contao 4 disqus 组件包
2.3.0
2022-10-11 10:35 UTC
Requires
- php: ^7.0 || ^8.0
- contao/core-bundle: ^4.9
- contao/news-bundle: ^4.9
- symfony/translation-contracts: ^1.0 || ^2.0 || ^3.0
- twig/twig: ^1.38 || ^2.7 || ^3.0
Requires (Dev)
- contao/manager-plugin: ^2.0
- contao/test-case: ^1.1
- friendsofphp/php-cs-fixer: ^2.2
- php-coveralls/php-coveralls: ^2.0
- php-http/guzzle6-adapter: ^1.1
- php-http/message-factory: ^1.0.2
- phpunit/phpunit: >=6.0 <6.5
- symfony/phpunit-bridge: ^3.2
README
将 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);