plenta / contao-news-like-bundle
将您的点赞按钮集成到 contao 新闻中。
1.1.0
2023-11-30 12:49 UTC
Requires
- php: >=8.1
- contao/core-bundle: ^4.13 || ^5.1
- contao/news-bundle: ^4.13 || ^5.1
Requires (Dev)
- contao/manager-bundle: ^4.13
- friendsofphp/php-cs-fixer: ^v3.7.0
Replaces
- contao-legacy/contao-protectedselect: 1.1.0
README
将您的点赞按钮集成到 contao 新闻中。
安装
使用 Contao Manager 安装
搜索 news like 并找到此扩展。
使用 Composer 安装
composer require plenta/contao-news-like-bundle
系统要求
- PHP:
^8.1
- Contao:
^4.13 || ^5.1
- Contao News Bundle:
^4.13 || ^5.1
使用方法
您可以使用我们的新闻模板或将点赞按钮集成到您自己的模板中。
使用我们的新闻模板
在新闻列表和/或新闻阅读器模块中,您可以选择我们的模板 news_latest_with_likes
或 news_full_with_likes
作为新闻模板。
将点赞按钮集成到您的模板中
要将点赞按钮集成到您的模板中,只需在您想要显示按钮的地方包含我们的 _plenta_likes.html.twig
Twig 模板。
在 PHP 模板中
<?php $this->insert('_plenta_likes', ['news' => $this->arrData]) ?>
在 Twig 模板中
{% include('@Contao/_plenta_likes.html.twig' with {news: _context}) %}
news
变量期望新闻项为数组。