Feature #79430

Make pagination possible without Extbase environment

Added by Thomas Löffler almost 4 years ago. Updated about 1 month ago.

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

0%

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.

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


Related issues

Related to TYPO3 Core - Bug #79922: fluid widget paginate - pagination links take no action New 2017-02-20
Related to TYPO3 Core - Feature #79403: Add library of universal, general-purpose ViewHelpers into f: namespace Closed 2017-01-21

History

#1 Updated by Thomas Löffler almost 4 years ago

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

#2 Updated by Gerrit Code Review almost 4 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

#3 Updated by Thomas Löffler over 3 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.

#4 Updated by Riccardo De Contardi over 3 years ago

  • Target version changed from 8 LTS to 9.0

#5 Updated by Claus Due over 3 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.

#6 Updated by Sebastian Helzle over 3 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.

#7 Updated by Susanne Moog over 2 years ago

  • Target version changed from 9.0 to 9.2

#8 Updated by Riccardo De Contardi over 2 years ago

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

#9 Updated by Susanne Moog over 2 years ago

  • Target version changed from 9.2 to Candidate for Major Version

#10 Updated by Klaus Weidenbach over 2 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.

#11 Updated by Robert Wildling over 2 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!

#12 Updated by Christian Kuhn about 2 years ago

  • Status changed from Under Review to New

#13 Updated by Christian Kuhn about 2 years ago

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

#14 Updated by Wolfgang Wagner about 1 year ago

Still the same problem in 9.5.9

#15 Updated by Thomas Löffler 11 months 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.

#16 Updated by Susanne Moog 11 months ago

  • Status changed from New to Closed

Closed as requested.

#17 Updated by Jonas Eberle 7 months 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.

#18 Updated by Grégory Duchesnes about 1 month 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'
    ]
);

Also available in: Atom PDF