kiwilan / php-opds

PHP package to create OPDS feed (Open Publication Distribution System) for eBooks.
https://packagist.org/packages/kiwilan/php-opds
MIT License
6 stars 2 forks source link

[Bug]: Paginator revisited #38

Closed mikespub closed 7 months ago

mikespub commented 11 months ago

What happened?

I've been trying to find a good way to extend/replace the OpdsPaginator() so that it can generate the right output in json() or xml() without messing up the feeds in paginate() or using the wrong route(), but I can't seem to find it without some major code surgery.

Ideally I'd like to pass along the actual total, items per page and current page, perhaps with some callback to generate the right route for first/previous/next/last links, and then let json() and/or xml() do its work to generate the correct feed links.

Maybe we could have a public paginate() method in Opds() that could handle that, and not call some protected paginate() inside OpdsEngine()->feed() ?

How to reproduce the bug

Try to paginate

Package Version

1.0.30

PHP Version

8.2

Which operating systems does with happen with?

Linux

Notes

No response

ewilan-riviere commented 11 months ago

I see, it's a good idea, I will add this feature to create a fully custom paginator ;)

ewilan-riviere commented 7 months ago

A PR with a XML/JSON support is available: https://github.com/kiwilan/php-opds/pull/43

ewilan-riviere commented 7 months ago

v2.0.0 ready with new paginate() method!

mikespub commented 7 months ago

Thanks - seems to work fine :-)