TYPO3 Logo
TYPO3 Explained
Release: main

Loading data.

  • Introduction

TYPO3 A-Z

  • Ajax
    • Client-side programming
    • Backend
  • Assets (CSS, JavaScript, Media)
  • Authentication
    • Multi-Factor Authentication
  • Autoloading
    • ComposerClassLoader
  • Backend access control (Users & Roles)
    • Users and groups
    • Password reset functionality
    • Roles
    • Access Control Options
    • Other Options
    • More about file mounts
    • Backend users module
  • Backend routing
  • Backend user object
  • Bootstrapping
  • Broadcast channels
  • Caching
    • Quick Start for Integrators
    • Configuration
    • Caching Framework Architecture
    • Cache Frontends
    • Cache backends
    • Developer Information
  • Coding Guidelines
    • Introduction
    • PHP Coding Guidelines
      • PHP File Formatting
        • General Requirements for PHP Files
        • File Structure
        • PHP Syntax Formatting
        • Using phpDoc
      • PHP Architecture
        • Modeling Cross Cutting Concerns
          • Static Methods, static Classes, Utility Classes
          • Traits
          • Services
        • Working With Exceptions
        • General Links
      • Coding: Best practices
        • Accessing the Database
        • Singletons
        • Static Methods
        • Localization
        • Unit Tests
        • Handling Deprecation
        • Namespaces and Class Names of User Files
        • Hook Naming
    • JavaScript Coding Guidelines
    • TypeScript Coding Guidelines
    • TypoScript Coding Guidelines
    • TSconfig Coding Guidelines
    • Xliff Coding Guidelines
    • Yaml Coding Guidelines
    • reStructuredText (reST)
  • Configuration
    • Configuration overview
    • Glossary
    • Configuration module
    • Feature toggles
    • $GLOBALS
    • $GLOBALS[‘TYPO3_CONF_VARS’]
      • $GLOBALS[‘TYPO3_CONF_VARS’][‘BE’]
      • $GLOBALS[‘TYPO3_CONF_VARS’][‘DB’]
      • $GLOBALS[‘TYPO3_CONF_VARS’][‘EXT’]
      • $GLOBALS[‘TYPO3_CONF_VARS’][‘FE’]
      • $GLOBALS[‘TYPO3_CONF_VARS’][‘GFX’]
      • $GLOBALS[‘TYPO3_CONF_VARS’][‘HTTP’]
      • $GLOBALS[‘TYPO3_CONF_VARS’][‘MAIL’]
      • $GLOBALS[‘TYPO3_CONF_VARS’][‘SYS’]
    • Global meta information about TYPO3
    • TSconfig
    • TypoScript syntax
      • What Is TypoScript?
      • Syntax
        • Introduction
        • Contexts
        • TypoScript syntax
        • Conditions
        • Includes
      • Sorting out details
        • Parsing, Storing and Executing TypoScript
        • Myths, FAQ and acknowledgements
      • The TypoScript Parser API
        • Introduction
        • Parsing Custom TypoScript
        • Implementing Custom Conditions
    • User settings configuration
      • [‘columns’] Section
      • [‘showitem’] section
      • Extending the user settings
      • View the configuration
    • YAML
      • YAML API
      • YAML syntax
      • Services.yaml
  • Constants
  • Content Elements & Plugins
    • Introduction
    • Create a custom content element type
    • Custom data processors
    • Create plugins
    • Configure Custom Backend Preview for Content Element
    • Add content elements to the Content Element Wizard
    • Flexforms
    • T3DataStructure
      • Elements
      • Sheet References
      • Parsing a Data Structure
    • Backend layout
    • Best practices
  • Context API and Aspects
  • Crop Variants for Images
    • General Configuration
    • Crop variants configuration per content element
  • Custom file processors
  • Database (Doctrine DBAL)
    • Introduction
    • Configuration
    • Database Structure
    • Upgrade table and field definitions
    • Basic create, read, update, and delete operations (CRUD)
    • Class Overview
    • ConnectionPool
    • QueryBuilder
    • Connection
    • ExpressionBuilder
    • RestrictionBuilder
    • Result
    • QueryHelper
    • Migrating from TYPO3_DB
    • Various Tips and Tricks
  • Debugging
  • Dependency injection
  • Deprecation
  • Directory structure
  • Enumerations & BitSets
    • How to use enumerations
    • How to use bitsets
  • Environment
  • Error and exception handling
    • Configuration
    • Error Handler
    • Production Exception Handler
    • Debug exception handler
    • Examples
    • How to extend the error and exception handling
  • Events and hooks
    • Extending the TYPO3 Core
    • EventDispatcher (PSR-14 Events)
    • Event list
      • Backend
        • AfterFormEnginePageInitializedEvent
        • AfterHistoryRollbackFinishedEvent
        • AfterPageColumnsSelectedForLocalizationEvent
        • AfterPagePreviewUriGeneratedEvent
        • BeforeFormEnginePageInitializedEvent
        • BeforeHistoryRollbackStartEvent
        • BeforePagePreviewUriGeneratedEvent
        • ModifyClearCacheActionsEvent
        • ModifyGenericBackendMessagesEvent
        • ModifyImageManipulationPreviewUrlEvent
        • ModifyInlineElementControlsEvent
        • ModifyInlineElementEnabledControlsEvent
        • ModifyLinkExplanationEvent
        • ModifyNewContentElementWizardItemsEvent
        • ModifyPageLayoutContentEvent
        • ModifyPageLayoutOnLoginProviderSelectionEvent
        • ModifyQueryForLiveSearchEvent
        • SwitchUserEvent
        • SystemInformationToolbarCollectorEvent
      • Core
        • Events in EXT:core
          • AfterGroupsResolvedEvent
        • Configuration
          • AfterTcaCompilationEvent
          • ModifyLoadedPageTsConfigEvent
        • Core
          • BootCompletedEvent
        • DataHandling
          • AppendLinkHandlerElementsEvent
          • IsTableExcludedFromReferenceIndexEvent
        • Database
          • AlterTableDefinitionStatementsEvent
        • Domain
          • RecordAccessGrantedEvent
        • Html
          • BrokenLinkAnalysisEvent
        • Mail
          • AfterMailerInitializationEvent
          • AfterMailerSentMessageEvent
          • BeforeMailerSentMessageEvent
        • Package
          • AfterPackageActivationEvent
          • AfterPackageDeactivationEvent
          • BeforePackageActivationEvent
          • PackagesMayHaveChangedEvent
        • Page
          • BeforeJavaScriptsRenderingEvent
          • BeforeStylesheetsRenderingEvent
        • Resource
          • AfterFileAddedEvent
          • AfterFileAddedToIndexEvent
          • AfterFileCommandProcessedEvent
          • AfterFileContentsSetEvent
          • AfterFileCopiedEvent
          • AfterFileCreatedEvent
          • AfterFileDeletedEvent
          • AfterFileMarkedAsMissingEvent
          • AfterFileMetaDataCreatedEvent
          • AfterFileMetaDataDeletedEvent
          • AfterFileMetaDataUpdatedEvent
          • AfterFileMovedEvent
          • AfterFileProcessingEvent
          • AfterFileRemovedFromIndexEvent
          • AfterFileRenamedEvent
          • AfterFileReplacedEvent
          • AfterFileUpdatedInIndexEvent
          • AfterFolderAddedEvent
          • AfterFolderCopiedEvent
          • AfterFolderDeletedEvent
          • AfterFolderMovedEvent
          • AfterFolderRenamedEvent
          • AfterResourceStorageInitializationEvent
          • BeforeFileAddedEvent
          • BeforeFileContentsSetEvent
          • BeforeFileCopiedEvent
          • BeforeFileCreatedEvent
          • BeforeFileDeletedEvent
          • BeforeFileMovedEvent
          • BeforeFileProcessingEvent
          • BeforeFileRenamedEvent
          • BeforeFileReplacedEvent
          • BeforeFolderAddedEvent
          • BeforeFolderCopiedEvent
          • BeforeFolderDeletedEvent
          • BeforeFolderMovedEvent
          • BeforeFolderRenamedEvent
          • BeforeResourceStorageInitializationEvent
          • EnrichFileMetaDataEvent
          • GeneratePublicUrlForResourceEvent
          • ModifyFileDumpEvent
          • ModifyIconForResourcePropertiesEvent
          • SanitizeFileNameEvent
        • Tree
          • ModifyTreeDataEvent
      • Extbase
        • Mvc
          • AfterRequestDispatchedEvent
          • BeforeActionCallEvent
        • Persistence
          • AfterObjectThawedEvent
          • EntityAddedToPersistenceEvent
          • EntityPersistedEvent
          • EntityRemovedFromPersistenceEvent
          • EntityUpdatedInPersistenceEvent
          • ModifyQueryBeforeFetchingObjectDataEvent
          • ModifyResultAfterFetchingObjectDataEvent
      • ExtensionManager
        • AfterExtensionDatabaseContentHasBeenImportedEvent
        • AfterExtensionFilesHaveBeenImportedEvent
        • AfterExtensionStaticDatabaseContentHasBeenImportedEvent
        • AvailableActionsForExtensionEvent
      • Filelist
        • ProcessFileListActionsEvent
      • Frontend
        • AfterLinkIsGeneratedEvent
        • AfterPageAndLanguageIsResolvedEvent
        • AfterPageWithRootLineIsResolvedEvent
        • BeforePageIsResolvedEvent
        • FilterMenuItemsEvent
        • ModifyCacheLifetimeForPageEvent
        • ModifyHrefLangTagsEvent
        • ModifyPageLinkConfigurationEvent
        • ModifyResolvedFrontendGroupsEvent
        • ShouldUseCachedPageDataIfAvailableEvent
      • FrontendLogin
        • LoginConfirmedEvent
        • ModifyLoginFormViewEvent
        • SendRecoveryEmailEvent
      • Impexp
        • BeforeImportEvent
      • Info
        • ModifyInfoModuleContentEvent
      • Install
        • ModifyLanguagePackRemoteBaseUrlEvent
      • Linkvalidator
        • BeforeRecordIsAnalyzedEvent
        • ModifyValidatorTaskEmailEvent
      • Recordlist
        • ModifyRecordListHeaderColumnsEvent
        • ModifyRecordListRecordActionsEvent
        • ModifyRecordListTableActionsEvent
        • RenderAdditionalContentToRecordListEvent
      • Redirects
        • RedirectWasHitEvent
      • Seo
        • ModifyUrlForCanonicalTagEvent
      • Setup
        • AddJavaScriptModulesEvent
      • Workspaces
        • AfterCompiledCacheableDataForWorkspaceEvent
        • AfterDataGeneratedForWorkspaceEvent
        • GetVersionedDataEvent
        • ModifyVersionDifferencesEvent
        • SortVersionedDataEvent
    • Hooks
    • JavaScript Event API
      • Regular event
      • Debounce event
      • Throttle event
      • RequestAnimationFrame event
  • Extension Development
    • Concepts
      • Introduction
      • System and Local Extensions
      • Extbase
      • Further reading
    • File structure
      • composer.json
      • ext_conf_template.txt
      • ext_emconf.php
      • ext_localconf.php
      • ext_tables.php
      • ext_tables.sql
      • ext_tables_static+adt.sql
      • ext_typoscript_setup.typoscript
      • Classes
      • Configuration
        • Backend
        • TCA
        • TsConfig
        • TypoScript
        • Icons.php
        • page.tsconfig
        • RequestMiddlewares.php
        • Services.yaml
      • Documentation
      • Resources
        • Private
          • Language
        • Public
      • Tests
    • Howto
      • Creating a new extension
      • Creating a new distribution
      • Extension management
      • Adding documentation
      • Frontend plugin
        • AbstractPlugin
      • Backend modules
        • Backend interface
        • View registered modules
        • Without Extbase:
        • ‘iconIdentifier’ versus ‘icon’
        • Backend Template View (Extbase)
        • Backend module API (Extbase)
        • Register a toplevel module (Extbase)
        • The Backend Template View (core)
        • Backend module API (core)
      • Extending the TCA array
        • Storing the changes
        • Customization Examples
        • Verifying the TCA
      • Publish your extension
        • Publish your extension in the TER
      • Custom Extension Repository
    • Best practises and conventions
      • Choosing an extension key
      • Naming conventions
      • Configuration Files (ext_tables.php & ext_localconf.php)
  • Extension scanner
  • File abstraction layer (FAL)
    • Introduction
    • Basic concepts
    • Architecture
      • Overview
      • Folders
      • Database structure
      • Components
      • PSR-14 Events
    • Administration
      • Permissions
      • File storages
      • Maintenance
    • Using FAL
      • Using FAL in the Frontend
      • TCA Definition
      • The StorageRepository Class
      • Working With files, folders and file references
      • Working With Collections
      • Searching for Files
    • File collections
  • Flash messages
  • Fluid
    • Introduction to Fluid
    • Fluid syntax
    • ViewHelper reference
  • FormEngine
    • Introduction
    • Main rendering workflow
    • Data compiling
    • Rendering
  • Form protection tool
  • HTTP request library / Guzzle / PSR-7
  • Icon API
  • Internationalization and localization
    • Introduction
    • Supported languages
    • Managing translations for backend
    • Translation servers
      • Localization with Crowdin
        • Extension integration
        • Online translation with Crowdin
        • Workflow
        • Frequently Asked Questions (FAQ)
      • Localization with Pootle
      • Custom translation servers
    • XLIFF Format
    • Working with XLIFF files
  • JavaScript in TYPO3 Backend
    • RequireJS in the TYPO3 Backend
      • Use RequireJS in your own extension
      • Dependency handling
      • Loading your own or other RequireJS modules
      • Shim Library to Use it as Own RequireJS Modules
    • Client-side templating
    • Various JavaScript modules
      • Modals
      • Multi-step wizard
      • DocumentService (jQuery.ready substitute)
      • SessionStorage wrapper
    • Event Api
    • Navigation via JavaScript
    • JavaScript Form Helpers
  • LinkBrowser
    • LinkBrowser API
    • The LinkHandler API
      • The PageLinkHandler
      • The RecordLinkHandler
      • Implementing a custom LinkHandler
  • Locking API
  • Logging Framework
    • Quickstart
    • Logger
    • Configuration of the logging system
    • The LogRecord model
    • Log Writers
    • Log processors
  • Mail API
  • Mount points
  • Namespaces
  • Page types
    • Introduction
    • Types of pages
    • X-Redirect-By header for pages with redirect types
    • Create new Page Type
  • Pagination
  • Password hashing
    • Troubleshooting
  • Request handling (Middlewares)
    • TYPO3 request object
  • Rich text editors (RTE)
    • CKEditor Rich Text Editor
    • Rendering in the Frontend
    • Rich text editors in the TYPO3 backend
      • Introduction
      • Plugging in a custom RTE
    • Rich Text Editors (RTE) in the TYPO3 frontend
      • Including a Rich Text Editor (RTE) in the frontend
    • RTE Transformations
      • Introduction
      • Transformation overview
    • Historical Perspective on RTE Transformations
      • Properties and Transformations
      • RTE Transformations in Content Elements
  • Routing - “Speaking URLs” in TYPO3
    • Introduction to Routing
    • Page based Routing
    • Advanced routing configuration (for extensions)
    • Extending Routing
    • Collection of various routing examples
  • Security guidelines
    • Introduction
    • The TYPO3 Security Team
    • General Information
    • Types of Security Threats
    • General guidelines
    • Guidelines for System Administrators
      • Role Definition
      • Integrity of TYPO3 Packages
      • File/directory permissions
      • Restrict access to files on a server-level
      • Directory indexing
      • File extension handling
      • Content security policy
      • Database access
      • Encrypted Client/server Communication
      • Other Services
      • Further Actions
    • Guidelines for TYPO3 integrators
      • Install tool
      • Global TYPO3 configuration options
      • Security-related warnings after login
      • Reports and logs
      • Users and access privileges
      • TYPO3 extensions
      • TypoScript
      • Content elements
    • Guidelines for editors
    • Backup strategy
    • Detect, analyze and repair a hacked site
      • Detect a hacked website
      • Take the website offline
      • Analyzing a hacked site
      • Repair/restore
      • Further actions
  • Search engine optimization (SEO)
    • Canonical API
    • MetaTag API
    • PageTitle API
    • XML sitemap
  • Services
    • Introduction
    • Using Services
      • Service precedence
      • Simple usage
      • Use with subtypes
      • Calling a chain of services
    • Configuration
      • Override service registration
      • Service configuration
      • Service type configuration
    • Developer’s Guide
      • Introducing a new service type
      • Implementing a service
      • Service API
      • Services API
  • Session handling in TYPO3
    • User session management
    • Session storage framework
  • Site handling
    • Basics
    • Creating a new site configuration
    • Base variants
    • Adding Languages
    • Error handling
      • Page-based error handler
      • Fluid-based error handler
      • Writing a custom page error handler
    • Writing a custom page error handler
    • Static routes
    • Using environment variables in the site configuration
    • Using site configuration in TypoScript
    • Using site configuration in conditions
    • Using site configuration in TCA foreign_table_where
    • Site settings
    • CLI tools for site handling
    • PHP API: accessing site configuration
    • Extending site configuration
  • Soft references
  • Symfony Console Commands (cli)
  • Symfony expression language
  • System categories
  • System registry
  • TCE (TYPO3 Core engine) & DataHandler
    • Introduction
    • Database: DataHandler basics (Formerly Known as TCEmain)
    • Using the DataHandler in scripts
    • The “/record/commit” Route
    • File Functions Basics
    • The “tce_file.php” API
  • Testing
    • History
    • Core testing
    • Extension testing
    • Project testing
    • Writing unit tests
    • Writing functional tests
    • Writing acceptance tests
    • FAQ
  • Upgrade wizards
    • The concept of upgrade wizards
    • Creating upgrade wizards
  • Versioning and Workspaces
  • XCLASSes (Extending Classes)
  • About This Manual
  • Sitemap
  • Index

PAGE CONTENTS

  • Pagination
    • Sliding window pagination
      • Usage
  1. Start
  2. Pagination
View source How to edit Edit on GitHub

Pagination¶

Note

Pagination via Fluid widgets was removed, see Breaking: #92529 - All Fluid widget functionality removed. Use the API documented here to implement your own pagination.

The TYPO3 Core provides an interface to implement the native pagination of lists like arrays or query results of Extbase.

The foundation of that new interface \TYPO3\CMS\Core\Pagination\PaginatorInterface is that it’s type agnostic. It means, that it doesn’t define the type of paginatable objects. It’s up to the concrete implementations to enable pagination for specific types. The interface only forces you to reduce the incoming list of items to an iterable sub set of items.

Along with that interface, an abstract paginator class \TYPO3\CMS\Core\Pagination\AbstractPaginator is available that implements the base pagination logic for any kind of Countable set of items while it leaves the processing of items to the concrete paginator class.

Two concrete paginators are available:

  • For type array: \TYPO3\CMS\Core\Pagination\ArrayPaginator
  • For type \TYPO3\CMS\Extbase\Persistence\QueryResultInterface: \TYPO3\CMS\Extbase\Pagination\QueryResultPaginator

Code example for the ArrayPaginator:

// use TYPO3\CMS\Core\Pagination\ArrayPaginator;

$itemsToBePaginated = ['apple', 'banana', 'strawberry', 'raspberry', 'pineapple'];
$itemsPerPage = 2;
$currentPageNumber = 3;

$paginator = new ArrayPaginator($itemsToBePaginated, $currentPageNumber, $itemsPerPage);
$paginator->getNumberOfPages(); // returns 3
$paginator->getCurrentPageNumber(); // returns 3, basically just returns the input value
$paginator->getKeyOfFirstPaginatedItem(); // returns 5
$paginator->getKeyOfLastPaginatedItem(); // returns 5

// use TYPO3\CMS\Core\Pagination\SimplePagination;

$pagination = new SimplePagination($paginator);
$pagination->getAllPageNumbers(); // returns [1, 2, 3]
$pagination->getPreviousPageNumber(); // returns 2
$pagination->getNextPageNumber(); // returns null
// …

Sliding window pagination¶

New in version 12.0.

The sliding window pagination can be used to paginate array items or query results from Extbase. The main advantage is that it reduces the amount of pages shown.

Example: Imagine 1000 records and 20 items per page which would lead to 50 links. Using the SlidingWindowPagination, you will get something like < 1 2 ... 21 22 23 24 ... 100 >.

Usage¶

Replace the usage of SimplePagination with \TYPO3\CMS\Core\Pagination\SlidingWindowPagination and you are done. Set the 2nd argument to the maximum number of links which should be rendered.

// use TYPO3\CMS\Extbase\Pagination\QueryResultPaginator;
// use TYPO3\CMS\Core\Pagination\SlidingWindowPagination;

$currentPage = $this->request->hasArgument('currentPage')
    ? (int)$this->request->getArgument('currentPage')
    : 1;
$itemsPerPage = 10;
$maximumLinks = 15;

$paginator = new QueryResultPaginator(
    $allItems,
    $currentPage,
    $itemsPerPage
);
$pagination = new SlidingWindowPagination(
    $paginator,
    $maximumLinks
);

$this->view->assign(
    'pagination',
    [
        'pagination' => $pagination,
        'paginator' => $paginator,
    ]
);
  • Previous
  • Next
  • Home
  • Contact
  • Issues
  • Repository

Last updated: Jun 20, 2022 18:26

Last rendered: Jun 20, 2022 18:29

TYPO3 Theme 4.6.2

© Copyright since 2012 by the TYPO3 contributors
  • Legal Notice
  • Privacy Policy