kiwilan / php-opds

PHP package to create OPDS feed (Open Publication Distribution System) for eBooks.

Home Page:https://packagist.org/packages/kiwilan/php-opds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Paginator revisited

mikespub opened this issue · comments

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

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

A PR with a XML/JSON support is available: #43

v2.0.0 ready with new paginate() method!

Thanks - seems to work fine :-)