Pagination

These documentation pages are no longer maintained. Please visit the new documentation site.

Navigator

A simple object list is good for small lists, but not very efficient if we have many objects in a folder. We would then like to break up the list and for example only show the 10 latest objects and have navigation possibilities to see the other objects. The navigator itself is just a template we include that takes some parameters.

Example:

{let numberOfObjects=10}

{let articleCount=fetch( 'content', 'list_count',

                        hash( 'parent_node_id', $node.node_id ) )}

{let articleList=fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,

                                                'sort_by', $node.sort_array,

                                                'offset', $view_parameters.offset,

                                                'limit', $numberOfObjects ) )}

{section name=articleLoop loop=$articleList}

   {node_view_gui view=element content_node=$articleLoop:item}

{/section}

{include name=navigator

        uri='design:navigator/google.tpl'

        page_uri=concat( '/content/view/full/', $node.node_id, '/' )

        item_count=$articleCount

        view_parameters=$view_parameters

        item_limit=$numberOfObjects}

{/let}

{/let}

{/let}

As you can see, we do two fetches. First we fetch the total number of objects on the current position in the tree. Next we fetch only 10 articles and print these as normal. In the end of the list we will make the navigator. This is done by including one of the navigator templates (or by creating a new one). Two navigator templates are supplied, templates/navigator/simple.tpl and templates/navigator/google.tpl. simple.tpl is, as the name says, a very simple navigator you can use as an example to build your own, and google.tpl is a navigator with a design inspired by Google.

The navigator takes several parameters:

Parameter

Description

name

A name to identify the navigator

uri

The placement of the template file

page_uri

The URL to the current list

item_count

Total number of objects in the list

view_parameters

The array containing the view parameters

item_limit

Number of objects on each page

Comments

page by letters instead of numbers

is there anyway to page by letters instead of numbers?

Eg. by title's

multiple navigators on one page

can you do multiple navigators on one page, the offset value in the view does not seem to support this, or do I need to use namespaces or something else to accomplish this.

Contents

Customization

Access control
eZ publish API Documentation
Content structure
Custom design
    User specified parameters
    Template variables set by ezPublish
    Introduction
    Variables, arrays and objects
    Node
    Database connectivity
    Sections
    File placement
    Override templates
    node_view_gui
    Pagination
    Caching
    Stylesheets
    Pagelayout
    Printable pages
    Examples
Components
Tips & Tricks
Troubleshooting


Created

04/07/2003
11:30:51 am
by Bård Farstad

Last updated

08/07/2003
1:18:37 pm
by Bård Farstad

Authors

Bård Farstad



This page is part of the eZ Publish documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.