2017 © Pedro Peláez
 

contao-bundle contao-news-pagination-bundle

This bundle offers content pagination for the news reader.

image

heimrichhannot/contao-news-pagination-bundle

This bundle offers content pagination for the news reader.

  • Thursday, July 26, 2018
  • by digitales@heimrich-hannot.de
  • Repository
  • 6 Watchers
  • 0 Stars
  • 91 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 18 Versions
  • 18 % Grown

The README.md

News Pagination

This bundle offers automatic content pagination for the core news reader module and the heimrichhannot/contao-reader-bundle., (*1)

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, (*2)

    composer require heimrichhannot/contao-news-pagination-bundle
  2. Update database, (*3)

  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., (*4)

Example:, (*5)

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;
                }
            ]);
    }
}

The Versions

26/07 2018

dev-master

9999999-dev

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

26/07 2018

2.1.7

2.1.7.0

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

26/07 2018

2.1.6

2.1.6.0

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

06/07 2018

2.1.5

2.1.5.0

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

28/06 2018

2.1.4

2.1.4.0

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

04/06 2018

2.1.3

2.1.3.0

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

20/04 2018

2.1.2

2.1.2.0

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

17/04 2018

2.1.1

2.1.1.0

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

15/03 2018

2.1.0

2.1.0.0

This bundle offers content pagination for the news reader.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires