Fluid: Paginate Widget

Überschreiben der Sprachkeys

ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:fluid/Resources/Private/Language/locallang.xlf'][] = 'EXT:my_ext/Resources/Private/Language/locallang_fluid.xlf';

Mit _LOCAL_LANG in TypoScript kann man diese Sprachkeys nicht überschreiben. In der Datei locallang_fluid.xlf muss man nur die Sprachkeys aufnehmen, die man überschreiben möchte.

Achtung: Die neuen Sprachkeys gelten für alle Paginate Widgets, nicht nur für die in der Extension „my_ext“.

Eigenes Template

# Zentral für alle Extensions
config.tx_extbase.view.widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPath = EXT:my_ext/Resources/Private/Templates/
# Nur für eine bestimmte Extension
plugin.tx_extension.view.widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPath = EXT:my_ext/Resources/Private/Templates/

Dann muss man noch das Template aus Verzeichnis typo3/sysext/fluid/Resources/Private/Templates/ViewHelpers/Widget/Paginate/ in Verzeichnis EXT:my_ext/Resources/Private/Templates/ViewHelpers/Widget/Paginate/ kopieren.

Pager nicht anzeigen bei nur einer Seite

Wenn es nur Items für eine Seite gibt, ist der Pager unnötig:

EXT:my_ext/Resources/Private/Templates/ViewHelper/Widget/Paginate/Index.html

<f:section name="paginator">
    <f:if condition="{pagination.numberOfPages} > 1">

Bootstrap Pagination

Angepasstes Template für Bootstrap (getbootstrap.com/components/#pagination).

EXT:my_ext/Resources/Private/Templates/ViewHelper/Widget/Paginate/Index.html

<f:if condition="{configuration.insertAbove}">
    <f:render section="paginator" arguments="{pagination: pagination, configuration: configuration}" />
</f:if>
 
<f:renderChildren arguments="{contentArguments}" />
 
<f:if condition="{configuration.insertBelow}">
    <f:render section="paginator" arguments="{pagination: pagination, configuration: configuration}" />
</f:if>
 
<f:section name="paginator">
    <f:if condition="{pagination.numberOfPages} > 1">
        <nav aria-label="Page navigation">
            <ul class="pagination">
                <li class="previous{f:if(condition: pagination.previousPage, else: ' disabled')}">
                    <f:if condition="{pagination.previousPage} > 1">
                        <f:then>
                            <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}" arguments="{currentPage: pagination.previousPage}" additionalAttributes="{aria-label: '{f:translate(key: \"widget.pagination.previous\")}'}">
                                <span aria-hidden="true">&laquo;</span>
                            </f:widget.link>
                        </f:then>
                        <f:else>
                            <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}" additionalAttributes="{aria-label: '{f:translate(key: \"widget.pagination.previous\")}'}">
                                <span aria-hidden="true">&laquo;</span>
                            </f:widget.link>
                        </f:else>
                    </f:if>
                </li>
                <f:if condition="{pagination.displayRangeStart} > 1">
                    <li>
                        <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}">
                            1
                        </f:widget.link>
                    </li>
                </f:if>
                <f:if condition="{pagination.hasLessPages}">
                    <li class="disabled">
                        <span aria-hidden="true">...</span>
                    </li>
                </f:if>
                <f:for each="{pagination.pages}" as="page">
                    <f:if condition="{page.isCurrent}">
                        <f:then>
                            <li class="active">
                                <span>{page.number} <span class="sr-only">(current)</span></span>
                            </li>
                        </f:then>
                        <f:else>
                            <li>
                                <f:if condition="{page.number} > 1">
                                    <f:then>
                                        <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}" arguments="{currentPage: page.number}">
                                            {page.number}
                                        </f:widget.link>
                                    </f:then>
                                    <f:else>
                                        <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}">
                                            {page.number}
                                        </f:widget.link>
                                    </f:else>
                                </f:if>
                            </li>
                        </f:else>
                    </f:if>
                </f:for>
                <f:if condition="{pagination.hasMorePages}">
                    <li class="disabled">
                        <span aria-hidden="true">...</span>
                    </li>
                </f:if>
                <f:if condition="{pagination.displayRangeEnd} < {pagination.numberOfPages}">
                    <li>
                        <f:widget.link arguments="{currentPage: pagination.numberOfPages}" addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}">
                            {pagination.numberOfPages}
                        </f:widget.link>
                    </li>
                </f:if>
                <f:if condition="{pagination.nextPage}">
                    <li class="next{f:if(condition: pagination.nextPage, else: ' disabled')}">
                        <f:widget.link arguments="{currentPage: pagination.nextPage}" addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}" additionalAttributes="{aria-label: '{f:translate(key: \"widget.pagination.next\")}'}">
                            <span aria-hidden="true">&raquo;</span>
                        </f:widget.link>
                    </li>
                </f:if>
            </ul>
        </nav>
    </f:if>
</f:section>

 

Autor:
Geändert: Mittwoch, 23. November 2016 9:17 Uhr
Erstellt: Freitag, 21. November 2014 16:37 Uhr
Tags: , , , , , , ,
Themengebiet: Web Entwicklung, TYPO3

Trackback: Trackback-URL LoadingZu Favoriten hinzufügen

Kommentar abgeben