Tuskfish API V1.1.1
  • Package
  • Class

Packages

  • content
  • core
  • database
  • installation
  • security
  • user
  • utilities

Classes

  • TfArticle
  • TfAudio
  • TfBlock
  • TfBlockHandler
  • TfCollection
  • TfCollectionHandler
  • TfContentHandler
  • TfContentHandlerFactory
  • TfContentObject
  • TfDownload
  • TfImage
  • TfMetadata
  • TfPaginationControl
  • TfRss
  • TfSearchContent
  • TfStatic
  • TfTag
  • TfTagHandler
  • TfTaglinkHandler
  • TfTemplate
  • TfVideo

Traits

  • TfContentTypes

Class TfPaginationControl

Generates pagination controls for paging through content.

The number of pagination control slots is set in Tuskfish Preferences. Choose an odd number for best results.

Package: content
Copyright: Simon Wilkinson 2013+ (https://tuskfish.biz)
License: GNU General Public License (GPL) V2
Author: Simon Wilkinson simon@isengard.biz
Version: Release: 1.0
Since: 1.1
Var: TfValidator $validator Instance of the Tuskfish data valiator class.
Var: TfPreference $preference Instance of the Tuskfish site preference class.
Var: int $count Number of content objects (pages) matching these parameters.
Var: int $limit Number of content objects to retrieve in current view.
Var: string $url Target base URL for pagination control links.
Var: int $start Position in result set to retrieve content objects from.
Var: int $tag ID of tag used to filter content.
Var: array $extraParams Query string to be appended to the URLs (control script params).
Located at trust_path/libraries/tuskfish/class/TfPaginationControl.php

Methods summary

public
# __construct( TfValidator $validator, TfPreference $preference )

Constructor.

Constructor.

Parameters

$validator
An instance of the Tuskfish data validator class.
$preference
An instance of the Tuskfish site preferences class.
public string
# renderPaginationControl( )

Creates a pagination control designed for use with the Bootstrap framework.

Creates a pagination control designed for use with the Bootstrap framework.

$query is an array of arbitrary query string parameters. Note that these need to be passed in as an array of key => value pairs, and you should build this yourself using known and whitelisted values. Do not pass through random query strings someone gave you on the internetz.

If you want to create pagination controls for other presentation-side libraries add additional methods to this class.

Returns

string
HTML pagination control.
public
# __set( string $property, mixed $value )

Disallow direct setting of properties.

Disallow direct setting of properties.

Parameters

$property
Name of property.
$value
Value to assign to property.
public
# setCount( integer $count )

Set the count property, which represents the number of objects matching the page parameters.

Set the count property, which represents the number of objects matching the page parameters.

Parameters

$count
public
# setLimit( integer $limit )

Sets the limit property, which controls the number of objects to be retrieved in a single page view.

Sets the limit property, which controls the number of objects to be retrieved in a single page view.

Parameters

$limit
Number of content objects to retrieve in current view.
public
# setUrl( string $url )

Set the base URL for pagination control links.

Set the base URL for pagination control links.

Parameters

$url
Base file name for constructing URLs, without the extention.
public
# setStart( integer $start )

Set the starting position in the set of available object.

Set the starting position in the set of available object.

Parameters

$start
ID of first object to view in the set of available records.
public
# setTag( integer $tag )

Set the ID of a tag used to filter content.

Set the ID of a tag used to filter content.

Parameters

$tag
ID of tag used to filter content.
public boolean
# setExtraParams( array $extraParams )

Set extra parameters to be included in pagination control links.

Set extra parameters to be included in pagination control links.

$extraParams is a potential XSS attack vector. The key => value pairs be i) rawurlencoded and ii) entity escaped. However, in order to avoid messing up the query and avoid unnecessary decoding it is possible to maintain manual control over the operators. (Basically, input requiring encoding or escaping is absolutely not wanted here, it is just being conducted to mitigate XSS attacks). If you actually want to use such input (check your sanity), you will need to decode it prior to use on the landing page.

Parameters

$extraParams
Query string to be appended to the URLs (control script params)

Returns

boolean
Returns false on failure.

Properties summary

protected $validator
#
protected $preference
#
protected $count
#
protected $limit
#
protected $url
#
protected $start
#
protected $tag
#
protected $extraParams
#
Tuskfish API V1.1.1 API documentation generated by ApiGen