README.textile

September 14, 2018 · View on GitHub

h1. etc_pagination

"Download":https://github.com/etc-plugins/etc_pagination/releases | "Packagist":https://packagist.org/packages/etc-plugins/etc_pagination

This Textpattern plugin creates a paginated navigation bar on listings. It has a wide variety of attributes - so you are able to customise it until you drop! It can be used alone for @<txp:article />@ and @<txp:article_custom />@ pagination, but it also has the ability to paginate any list, with a little help from "etc_query":http://www.iut-fbleau.fr/projet/etc/index.php?id=3.

Please report bugs and problems with this plugin at "the GitHub project's issues page":https://github.com/etc-plugins/etc_pagination/issues.

p(alert-block information). Note that this plugin creates a list that is meant to be styled by you using CSS.

h2. Installing

Using "Composer":https://getcomposer.org:

bc. $ composer require etc-plugins/etc_pagination:*

Or download the latest version of the plugin from "the GitHub project page":https://github.com/etc-plugins/etc_pagination/releases, paste the code into the Textpattern Plugins administration panel, install and enable the plugin. Visit the "forum thread":https://forum.textpattern.io/viewtopic.php?id=39302 for more info or to report on the success or otherwise of the plugin.

h2. Requirements

  • Textpattern 4.5.0 or newer.

h2. Tags

h3. etc_pagination tag

bc. <txp:etc_pagination />

The etc_pagination tag is a single or a container tag that renders the pagination widget HTML structure.

If used as a container, it must be specified as an opening and closing pair of tags, like this:

bc. txp:etc_pagination ...contained statements... </txp:etc_pagination>

h4. Attributes

  • @atts="value"@
    Additional attributes to apply to the @wraptag@ attribute value.
  • @break="value"@
    Where value is an HTML element, specified without brackets (e.g., @break="li"@) to separate list items.
  • @class="class name"@
    HTML @class@ to apply to the @wraptag@ attribute value.
  • @current="text"@
    A text active on the current tab.
  • @delimiter="value"@
    A string to use as delimiter in @general,current@ link pairs, see below. Default: @,@ (a comma).
  • @first="text"@
    Enables you to alter the text inside the 'first' link.
  • @gap="text"@
    One or two delimiter-separated symbols that state that there are more tabs before or after the ones currently viewable. Default: @…@.
  • @html_id="id"@
    The HTML @id@ attribute assigned to the @wraptag@ attribute value.
  • @last="text"@
    Enables you to alter the text inside the 'last' link.
  • @link="text"@
    Enables you to alter the text in the titles of the page tabs. If two delimiter-separated strings are given, then the first one will be used on @general@ pages, and the second one on the @current@ page. Default: @{}@, where @{}@ will be replaced by appropriate tab numbers, see 'Replacements' section below.
  • @mask="value"@
    If set, the whole output will be constructed by replacing the patterns @{links}@, @{first}@, @{last}@, @{prev}@, @{next}@, @{<+}@ (gap before) and @{+>}@ (gap after) by corresponding strings. Default: unset.
  • @next="text"@
    Enables you to alter the text inside the 'next' link.
  • @offset="number"@
    Page number offset. Default: @0@.
  • @page="number"@
    An integer to be considered as @default@ page (typically @1@).
  • @pages="value"@
    The total number of pages, or a range @start..end@, or a delimiter-separated list of @page[::title]@ items. Not needed when paginating @<txp:article />@ tag (default value).
  • @pgcounter="value"@
    The URL parameter to drive the navigation. Not needed when paginating @<txp:article />@ tag. Default: @pg@.
  • @prev="text"@
    Enables you to alter the text inside the 'previous' link.
  • @query="a&b=c"@
    A @&@-separated list of GET parameters to be unset/modified in @root@.
  • @range="number"@
    The maximum number of left/right neighbours (including gaps) to display. If negative (default), all pages will be displayed. The plugin tries to avoid 'nonsense' gaps like @1 … 3 4@ and adjust the output so that the number of displayed tabs is @2*range+1@.
  • @reversenumberorder="number"@
    Makes it possible to reverse the numbers in the tabs. Setting to value to @0@ (default) renders @1,2,3,...@, setting value to @1@ reverses the link numbers, @2@ reverses theirs hrefs, and @3@ reverses both numbers and hrefs.
  • @root="URL"@
    The URL to be used as base for navigation, defaults to the current page URL.
  • @scale="1"@
    An integer to be used as grid for 'gap' links.
  • @wraptag="element"@
    HTML element to wrap (markup) block, specified without brackets (e.g., @wraptag="ul"@).

h4. Replacements

If you are not happy with the default @@ links, use @<etc_pagination />@ as container to construct your own links. The following replacement tokens are available inside @etc_pagination@:

  • @{$}@
    The absolute page number.
  • @{#}@
    The displayed page number.
  • @{*}@
    The page title.
  • @{current}@
    The text given by @current@ attribute, enabled only on the current tab.
  • @{href}@
    The page URL.
  • @{link}@
    The text given by @link@ attribute, replaced by @first@, @prev@, etc when necessary.
  • @{pages}@
    The total pages number.
  • @{rel}@
    The page relation (@next@, @prev@).

For example, the following (container tag) will generate a @