Download the PHP package ikkez/f3-pagination without Composer

On this page you can find all versions of the php package ikkez/f3-pagination. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package f3-pagination

F3 Pagination

This plugin provides a pagebrowser and some pagination utilities for the PHP Fat-Free Framework.

Requires PHP Fat-Free Framework 3.6.


Preview

The default pagebrowser template contains the default bootstrap class, which can look like this:

pagebrowser

Usage

1. Install

Copy pagination.php into your lib/ folder OR put the file into one of your include paths, you have defined in AUTOLOAD (like $f3->set('AUTOLOAD', 'app/;app/includes'); ).

The Pagination plugin uses a template file to generate the pagebrowser. Put this template (pagebrowser.html) in your UI folder. (i.e. if you've defined an UI dir like $f3->set('UI','templates/'), then move the pagebrowser template in there)

2. Routing

To make the routing between pages work, you need to add a new route, containing a token, that could be used by our Pagebrowser.

e.g. if you already use a route like $f3->route('GET /list', 'Blog->listAllArticles'); you have to add this route too: $f3->route('GET /list/@page', 'Blog->listAllArticles');

You can also group them into a single route statement like this:

3. Paginate your Records

Within your controller you need to paginate over your records. The most easiest way to do so, is to use a data mapper and its paginate method.

Now you got the subset of your records in the articleList f3 hive key. It's an array that contains information about the pagination state and the subset itself with all records as data mapper objects. Have a look at the paginate method for detailed description.

But basically, you can loop through the list by using this snippet:

4. Create the PageBrowser

Method A: Custom Tag

The easiest way to create the pagebrowser now, is to use the custom template tag renderer. This generates the pagebrowser directly from the inside of your template. Therefor just register the pagebrowser right at the start in your index.php:

Now you can use this view helper in your HTML template:

And you're done! Additional configuration can be done by adding more tag parameters (see below).

Method B: render it yourself within your controller

Now you can use {{ @pagebrowser | raw }} in your template, to insert the pagebrowser.

Configuration

Of course you can define another token key in your route, instead of @page. Therefor just set it as third argument on instantiation (here without @-symbol).

If your template is within another sub-directory, or you want to use different templates, you can change the template path with:

The Paginator builds links, depending on the current route. But sometimes you maybe want to serve other pagebrowser link. You can set another link path like this:

It will now build URLs like search/results/1, search/results/2, search/results/3.

You can also prefix your page links for a better visual and SEO experience:

Now your page links will look like these: list/page-1, list/page-2, list/page-3

You can also alter the range of next and previous pages, based on the current page (Default is 2):


Of course you can set all of these options in the custom tag too. Just have a look at this fully configured example tag:

You can also pass template variables to all of those arguments, like range="{{@range}}".

Testsuite

To add the tests to the fatfree-dev testing bench:

License

You are allowed to use this plugin under the terms of the GNU General Public License version 3 or later.

Copyright (C) 2022 Christian Knuth [ikkez]


All versions of f3-pagination with dependencies

PHP Build Version
Package Version
Requires bcosca/fatfree-core Version 3.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ikkez/f3-pagination contains the following files

Loading the files please wait ....