heimrichhannot/contao-news-pagination-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

heimrichhannot/contao-news-pagination-bundle

最新稳定版本:2.6.1

Composer 安装命令:

composer require heimrichhannot/contao-news-pagination-bundle

包简介

Automatic or manual content pagination for news or other content in contao.

README 文档

README

This bundle offers automatic content pagination for the core news reader module and the heimrichhannot/contao-reader-bundle.

Features

  • add a pagination for navigating between the news parts
  • automatic splitting
    • split news articles by an adjustable character amount respecting html tags
  • manual splitting
    • split news content by wrapping the content elements in special start and stop content elements
  • optional support for hofff/contao-content-navigation

Usage

Setup

  1. Install with composer or contao manager

     composer require heimrichhannot/contao-news-pagination-bundle
    
  2. Update database

  3. You'll find new configuration options in the news reader frontend module or your reader configuration

  4. Add <?= $this->newsPagination ?> to your details template (e.g. "news_full") to output the pagination navigation

Known limitations for automatic pagination

  • currently only ce_text not nested in another content element (like an accordion) is supported for splitting, other elements are removed properly according to current page number though (completely)

Developers

PaginationUtil

The script to do the automatic pagination can be used by developers by using the PaginationUtil.

Example:

use HeimrichHannot\NewsPaginationBundle\Util\PaginationUtil;
use Wa72\HtmlPageDom\HtmlPageCrawler;

class ParseArticlesListener {
    /** @var PaginationUtil */
    protected $paginationUtil;
    
    public function __invoke(FrontendTemplate $template, array $newsEntry, Module $module) {
        $result = $this->paginationUtil->paginateHtmlText($template->text, 500, 1, [
                'selector' => '.ce_text_custom div.text',
                'removePageElementsCallback' => function (array $result, int $currentPage, int $page) {
                    // Always show page 1
                    if (1 === $page) {
                        return false;
                    }
                    // Insert custom html after page 3
                    if (3 === $page) {
                        $someCustomInsertion = new HtmlPageCrawler('<div class="alert">Custom Notice!</div>');
                        $someCustomInsertion->insertAfter(end($result[$page])['element']);
                    }
                    // Remove all element not on the current page (default)
                    return $page != $currentPage;
                }
            ]);
    }
}

统计信息

  • 总下载量: 761
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2017-10-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固