Code Monkey home page Code Monkey logo

paginatedprocessors's Introduction

Paginatedprocessors

License Packagist Downloads TYPO3 TYPO3 TYPO3 Brightside

TYPO3 CMS dataProcessors with pagination

System requirements

  • TYPO3 v11, v12, v13

Features

  • PaginatedDatabaseQueryProcessor
  • PaginatedFilesProcessor
  • PaginatedMenuProcessor
  • Pagination on/off
  • Number of items per page
  • Number of pagination links
  • URL Segment from content element or TypoScript
  • Anchor links to content element or custom id

Installation & Updates

  • composer req t3brightside/paginatedprocessors or from TYPO3 extension repository paginatedprocessors
  • Include static template
  • Enable default CSS from constant editor: paginatedprocessors.enableDefaultStyles = 1
  • See the ChangeLog for updates and breaking changes

Usage

Available DataProcessors

Brightside\Paginatedprocessors\DataProcessing\PaginatedDatabaseQueryProcessor
Brightside\Paginatedprocessors\DataProcessing\PaginatedFilesProcessor
Brightside\Paginatedprocessors\DataProcessing\PaginatedMenuProcessor

TypoScript example

10 = Brightside\Paginatedprocessors\DataProcessing\PaginatedDatabaseQueryProcessor
10 {
  pagination {
    isActive = 1
    # isActive.field = tx_paginatedprocessors_paginationenabled

    itemsPerPage = 10
    itemsPerPage.override.field = tx_paginatedprocessors_itemsperpage

    pageLinksShown = 7
    pageLinksShown.override.field = tx_paginatedprocessors_pagelinksshown

    ## configure anchor links
    # anchorActive = 1
    anchorActive.field = tx_paginatedprocessors_anchor
    ## set element uid manually
    # anchorId = 123
    ## or current content element from uid field
    anchorId.field = uid
    # content uid overriden if custom anchor element set in pagination options
    anchorId.override.field = tx_paginatedprocessors_anchorid

    ## uniqueId is mandatory
    ## returns array 'pagination'
    ## URL example /21/2
    uniqueId.field = uid
    uniquePaginatorName = 0

    ## returns array 'pagination'
    ## URL example /gallery/2
    ## need to map in routeEnhancers, see PaginatedprocessorsByUnigueIdInTs
    # uniqueId = gallery

    ## returns array 'pagination_gallery'
    ## URL example /gallery/2
    ## need to map in routeEnhancers, see PaginatedprocessorsByUnigueIdInTs
    # uniqueId = gallery
    # uniquePaginatorName = 1
  }
  ...
}

Pagination link control examples

pageLinksShown = 1
[<<][<][-4/12-][>][>>]

pageLinksShown = 0 or is bigger than amount of pages + 2
[<][1][2][-3-][4][5][>]

pageLinksShown = 5
[<][1]…[5][6][-7-][8][9]…[60][>]

Template

<f:for each="{pages}" as="page" iteration="iterator">
  <f:render partial="List" arguments="{_all}" />
</f:for>
<f:if condition="{pagination.numberOfPages} > 1">
  <f:render partial="Pagination" arguments="{pagination:pagination}" />
</f:if>
<!-- with uniquePaginatorName turned on -->
<f:if condition="{pagination_gallery.numberOfPages} > 1">
  <f:render partial="Pagination" arguments="{pagination:pagination_gallery}" />
</f:if>

Route enhancers

routeEnhancers:
  PaginatedprocessorsByContentId:
    type: Simple
    routePath: '/{paginatorId}/{paginationPage}'
    aspects:
      paginatorId:
        type: PaginatedprocessorsContentMapper
      paginationPage:
        type: StaticRangeMapper
        start: '0'
        end: '999'
  PaginatedprocessorsByUnigueIdInTs:
    type: Simple
    routePath: '/{paginatorId}/{paginationPage}'
    aspects:
      paginatorId:
        type: StaticValueMapper
        map:
          files: files
          gallery: gallery
      paginationPage:
        type: StaticRangeMapper
        start: '0'
        end: '999'

In your own extensions

Add pagination fields to custom content element

# There's a palette available to use for tt_content
--palette--;Pagination;paginatedprocessors,

Paginate a custom dataProcessor

Follow the comments in: PaginatedDatabaseQueryProcessor.php

Sources

Development and maintenance

Brightside OÜ – TYPO3 development and hosting specialised web agency

paginatedprocessors's People

Contributors

t3brightside avatar georgringer avatar whmyr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.