Project

General

Profile

Actions

Feature #79430

closed

Make pagination possible without Extbase environment

Added by Thomas Löffler over 7 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Start date:
2017-01-23
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
fluid, paginate
Complexity:
Sprint Focus:

Description

Problem:
I am using the DataProcessor to get records from the database and I want to paginate them.
As there is an array it works for the first page, but all other pages don't work due to the wrong parameter given for the page number.

In Extbase extensions there is the parameter tx_myplugin_mycontroller[@widget][currentPage]
When using the array from the DataProcessor I get tx__[@widget][currentPage]

Solution:
It would be cool to set the parameter manually by configuration in the f:widget.paginate ViewHelper, so I can use it for non-Extbase environments as well.


Files

just_news_0.0.7.zip (29.1 KB) just_news_0.0.7.zip Thomas Löffler, 2017-01-28 19:26

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #79922: fluid widget paginate - pagination links take no actionClosed2017-02-20

Actions
Related to TYPO3 Core - Feature #79403: Add library of universal, general-purpose ViewHelpers into f: namespaceClosed2017-01-21

Actions
Actions #1

Updated by Thomas Löffler over 7 years ago

  • Subject changed from Make pagination possible without Extbase stuff to Make pagination possible without Extbase environment
Actions #2

Updated by Gerrit Code Review over 7 years ago

  • Status changed from New to Under Review

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51376

Actions #3

Updated by Thomas Löffler about 7 years ago

I've attached my extension with a pagebrowser.

1) Install the extension
2) Include static template
3) Create a sysfolder and as subpages multiple news pages
4) Create a news_list content element
5) The pagebrowser actually shows maximum 3 items

Imho the patch of https://review.typo3.org/51376 does not contain any changes which touches this issue.

Actions #4

Updated by Riccardo De Contardi about 7 years ago

  • Target version changed from 8 LTS to 9.0
Actions #5

Updated by Claus Due about 7 years ago

Imho the patch of https://review.typo3.org/51376 does not contain any changes which touches this issue.

It does that by providing iterator viewhelpers capable of returning the slice/next/prev/current/max etc. values that you need when you're creating links that contain for example a page number and number of items per page. With those two values the rest can be calculated with the ViewHelpers that would be added by the patch in question.

Actions #6

Updated by Sebastian Helzle almost 7 years ago

We had the same problem with 8.7 LTS and dataprocessors.

I found a way around it by passing values to the extbase subproperties of the FluidTemplate object.

extbase {
        pluginName = Demo
        controllerName = Demo
        controllerExtensionName = website
        controllerActionName = show
}

Then it works perfectly fine. Also adding a rule for realurl based on those values works without a problem.
So apparently there is no need for an actual Environment there.

If we find any issues with this solution in our project I will post it.

Actions #7

Updated by Susanne Moog about 6 years ago

  • Target version changed from 9.0 to 9.2
Actions #8

Updated by Riccardo De Contardi about 6 years ago

  • Related to Bug #79922: fluid widget paginate - pagination links take no action added
Actions #9

Updated by Susanne Moog about 6 years ago

  • Target version changed from 9.2 to Candidate for Major Version
Actions #10

Updated by Klaus Weidenbach about 6 years ago

Tried to add pagination to a default File Lists content element in TYPO3 9.1 which uses a FilesProcessor. I have customised the Uploads.html template from fluid_styled_content to include f:widget.paginate and the first paginated page is displayed correctly, but all other paginated pages do not work. I realised the same behaviour as described in this issue.
The workaround from comment 6 does help, but is not so obvious I think.

Actions #11

Updated by Gone With the Wind about 6 years ago

Sebastian Helzle wrote:

We had the same problem with 8.7 LTS and dataprocessors.

I found a way around it by passing values to the extbase subproperties of the FluidTemplate object.

extbase {
pluginName = Demo
controllerName = Demo
controllerExtensionName = website
controllerActionName = show
}

Sebastian: could you share a bit more code for those, who are not so experienced? Where exactly do you add that code? What if my extension has 10 plugins or so? What to do then?
Thank you!

Actions #12

Updated by Christian Kuhn over 5 years ago

  • Status changed from Under Review to New
Actions #13

Updated by Christian Kuhn over 5 years ago

  • Related to Feature #79403: Add library of universal, general-purpose ViewHelpers into f: namespace added
Actions #14

Updated by Wolfgang Wagner over 4 years ago

Still the same problem in 9.5.9

Actions #15

Updated by Thomas Löffler over 4 years ago

It's working with Sebastians approach: https://forge.typo3.org/issues/79430#note-6

A working example can be seen here: https://git.spooner.io/spooner/just_news/blob/development/1.x/Configuration/TypoScript/RenderingDefinitions/NewsList.typoscript#L4

From my point of view this ticket can be closed.

Actions #16

Updated by Susanne Moog over 4 years ago

  • Status changed from New to Closed

Closed as requested.

Actions #17

Updated by Jonas Eberle about 4 years ago

FLUIDTEMPLATE could use a generated string (e.g. from current content element ID) as a default if these values are not set.
That would make f:paginate work out of the box.

I am ready to have a go at that.

As the docs for the ViewHelper are not mentioning that right now, I see that as a BUG, not a FEATURE.

Actions #18

Updated by Grégory Duchesnes over 3 years ago

Definitely a BUG since this VH can not be used in the most basic use case :

page = PAGE
page {
10 = FLUIDTEMPLATE
templateName = Mypage
}

Where Mypage.html contains for exemple

<f:widget.paginate objects="{myBlogPages}" as="paginatedBlogs" configuration="{itemsPerPage:6}">
    <f:for each="{paginatedBlogs}" as="pageRecord" iteration="i">
...
    </f:for>
</f:widget.paginate>

BTW : Sebastian's hack only work if you add this to your ext_localconf.php as well :

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'just_news',
    'NewsList',
    [
        'JustNews' => 'list'
    ]
);
Actions

Also available in: Atom PDF