zeroseven / z7_blog

[DEPRECATED] Blog-Extension for TYPO3
https://extensions.typo3.org/extension/pagebased_blog
3 stars 1 forks source link

"normal" pagination possible? #2

Closed alsodenn closed 3 years ago

alsodenn commented 3 years ago

Thank you for your extension. It makes a very good, clean and useful impression. I have a question:

Is it possible to create a "normal" pagination without Ajax without much effort? So like you know it from other TYPO3 extensions like in tx_news or similar:

[previous page], [page 1], [page 2], [page3], [next page]

raphaelthanner commented 3 years ago

Hello, nice that you are enjoying the extension. You should easily get all the information you need via the pagination object. Here's an example:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:blog="http://typo3.org/ns/Zeroseven/Z7Blog/ViewHelpers" data-namespace-typo3-fluid="true">
    <ul>
        <!-- List posts of selected stage -->
        <f:for each="{pagination.stages.selected}" as="post">
            <li>
                <f:link.page pageUid="{post.uid}">{post.title}</f:link.page>
            </li>
        </f:for>
    </ul>

    <ul>
        <!-- Previous stage -->
        <f:if condition="{pagination.previousStage} || {pagination.previousStage} === 0">
            <li>
                <blog:link.pagination stage="{pagination.previousStage}">Prev</blog:link.pagination>
            </li>
        </f:if>

        <!-- List available stages -->
        <f:for each="{pagination.stages}" as="stage" iteration="i">
            <li>
                <blog:link.pagination stage="{stage.index}">
                    <f:if condition="{stage.selected}">
                        <f:then><u>{i.cycle}</u></f:then>
                        <f:else>{i.cycle}</f:else>
                    </f:if>
                </blog:link.pagination>
            </li>
        </f:for>

        <!-- Next stage -->
        <f:if condition="{pagination.nextStage}">
            <li>
                <blog:link.pagination stage="{pagination.nextStage}">Next</blog:link.pagination>
            </li>
        </f:if>
    </ul>
</html>
srosskopf commented 3 years ago

I hope @raphaelthanner answered your question 🙂 I'll go on and close this issue, if you have any other questions or feedback feel free to reopen this issue or open a new one.