class Toolbox (View source)

The Toolbox class holds all methods to be used within the template files.

Properties

private $Automad Automad object.
private $collection The full collection of pages.

Methods

__construct(Automad $Automad)

The Automad object is passed as an argument. It shouldn't be created again (performance).

string
breadcrumbs(array $options = array())

Generate breadcrumbs to the current page, if the page's level is > 0 (not homepage / search results / page not found).

filelist(array $options = array())

Configure the filelist to be used in foreach loops.

string
img(array $options = array())

Place an image.

string
nav(array $options = array())

Generate a list for the navigation below a given URL.

string
navChildren(array $options = array())

Generate a list for the navigation below the current page.

string
navSiblings(array $options = array())

Generate a list for the navigation below the current page's parent.

string
navTop(array $options = array())

Generate a list for the navigation at the top level including the home page (level 0 & 1).

string
navTree(array $options = array())

Generate full navigation tree.

newPagelist(array $options = array())

Alias for calling the pagelist() method with the default options merged with the specified ones to override all previous configurations.

pagelist(array $options = array())

Change of configuration for Automad's Pagelist object.

string
queryStringMerge(array $options)

Merge passed key-value pairs ($options) with current query string.

redirect(array $options)

Redirect page.

set(array $options)

Set shared or session data variables by passing an array of key/value pairs.

Details

__construct(Automad $Automad)

The Automad object is passed as an argument. It shouldn't be created again (performance).

Parameters

Automad $Automad

string breadcrumbs(array $options = array())

Generate breadcrumbs to the current page, if the page's level is > 0 (not homepage / search results / page not found).

Options: - class: false (class of

<

ul> element) - excludeHidden: false (exclude hidden pages)

Parameters

array $options

Return Value

string The HTML of a breadcrumb navigation

filelist(array $options = array())

Configure the filelist to be used in foreach loops.

Parameters

array $options

string img(array $options = array())

Place an image.

Options: - file: false (filepath or glob pattern - when using a glob pattern, the first match is used) - width: false (width in pixels) - height: false (height in pixels) - crop: false (crop image) - class: false (class for the element)

Parameters

array $options
  • (file: path/to/file (or glob pattern), width: px, height: px, crop: 1)

Return Value

string The HTML for the image output

string nav(array $options = array())

Generate a list for the navigation below a given URL.

Options: - context: '/' (The parent URL) - hompage: false (include homepage to first-level nav) - excludeHidden: true (exclude hidden pages) - class: false (class of the

<

ul> element) - active: false (class of the active

  • element)

  • Parameters

    array $options

    Return Value

    string The HTML of a navigation list

    string navChildren(array $options = array())

    Generate a list for the navigation below the current page.

    Options are the same like those for nav() except the 'context' option.

    Parameters

    array $options

    Return Value

    string The HTML of the navigation list

    string navSiblings(array $options = array())

    Generate a list for the navigation below the current page's parent.

    Options are the same like those for nav() except the 'context' option.

    Parameters

    array $options

    Return Value

    string The HTML of the navigation list

    string navTop(array $options = array())

    Generate a list for the navigation at the top level including the home page (level 0 & 1).

    Options are the same like those for nav() except the 'context' option.

    Parameters

    array $options

    Return Value

    string The HTML of the navigation list

    string navTree(array $options = array())

    Generate full navigation tree.

    Options: - all: true (expand all pages or only in current path) - context: '' (parent URL) - rootLevel: false (a kind of flexible context page at a given level) - excludeHidden: true (exclude hidden pages) - class: false (class of the

    <

    ul> element) - active: false (class of the active

  • element)

  • Parameters

    array $options
    • (all: expand all pages (boolean), context: "/parenturl", rootLevel: integer)

    Return Value

    string The HTML of the tree

    newPagelist(array $options = array())

    Alias for calling the pagelist() method with the default options merged with the specified ones to override all previous configurations.

    Parameters

    array $options

    pagelist(array $options = array())

    Change of configuration for Automad's Pagelist object.

    Options:

    • context: an optionally fixed URL for the context of a pagelist of type breadcrumbs or children. In case this parameter is false, within a loop the context always changes dynamically to the current page.
    • excludeCurrent: default false
    • excludeHidden: default true
    • filter: filter pages by tags
    • limit: limit the object's array of relevant pages
    • offset: offset the within the array of all relevant pages
    • page: false (the current page in the pagination - to be used with the limit parameter)
    • search: filter pages by search string
    • sort: sorting options string, like "date desc, title asc"
    • template: include only pages matching that template
    • type: sets the type of pagelist (default is false) - valid types are false (all), "children", "related", "siblings" and "breadcrumbs"

    Parameters

    array $options

    string queryStringMerge(array $options)

    Merge passed key-value pairs ($options) with current query string.

    Parameters

    array $options

    Return Value

    string The merged query string

    redirect(array $options)

    Redirect page.

    Parameters

    array $options

    set(array $options)

    Set shared or session data variables by passing an array of key/value pairs.

    Parameters

    array $options