How to get Next, Previous, and numbered page links

Author Message

Eric Floehr

Monday 07 April 2003 7:56:57 am

Hi,

I have been playing with ezPublish, and the demo. Is there any example template code to get "Next", "Previous", and the numbered page links like appear at the bottom of this forum for example? I know it will have to do something with offset, but I can't get things to be generic enough to always work. Any pointers?

Thanks!
Eric

Jan Borsodi

Tuesday 08 April 2003 2:28:58 am

You can use the generic navigators which are shipped with eZ publish, they require some input variables and will automatically generate the required html.

For instance:
{include name=navigator
uri='design:navigator/google.tpl'
page_uri=concat('/content/view','/full/',$node.node_id)
item_count=$list_count
view_parameters=$view_parameters
item_limit=$page_limit}

uri: The template to include, you can also use simple.tpl. It can also be a good idea to look at these templates to so how it is done.
page_uri: The uri to the current page, the offset will be appended to this uri.
item_count: The maximum number of items the list contains
view_parameters: Parameters which are specific to views, contains for instance offset. Might be extended in the future.
item_limit: The maximum number of items on this page

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Eric Floehr

Wednesday 09 April 2003 11:13:27 am

Thank you! This is working great!

Jonathan Stubbs

Tuesday 15 April 2003 1:41:07 pm

Hi,

Its not clear where we are supposed to set the variables - in the google.tpl/simple.tpl page or in the view page?

For example - I would like to show 10 news stories on the first page. Can someone enlighten me?

Thanks!

Jan Borsodi

Wednesday 16 April 2003 1:16:56 am

You set it in the view. Just copy the template code shown earlier and try changing some parameters to understand how it works.

Here's an example with 10 items per page, a total of 56 items and the current offset is 20 (page 3).
{include name=navigator
uri='design:navigator/google.tpl'
page_uri=concat('/content/view','/full/',$node.node_id)
item_count=56
view_parameters=hash(offset,20)
item_limit=10}

Normally view_parameters is set to use the local $view_parameter variable which is supplied from the view code.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

di sho

Wednesday 14 May 2003 2:01:55 pm

when I click on links (1,2,3 ....)
htis error appears
"Unavailable
The object is not available."
on page ..../content/view/full/16/offset/5
/content/view/full/16 - works great
can you help me

my code:
{include name=navigator
uri='design:navigator/google.tpl'
page_uri=concat('/content/view','/full/',$node.node_id)
item_count=$list_count
view_parameters=hash(offset,0)
item_limit=5}

Thanks

Patrick ALLAERT

Saturday 08 October 2005 6:41:37 am

It seems there is a bug in the template simple.tpl, you have to change in the code "/offset/" to "/(offset)/"

Patrick ALLAERT
http://www.dixite.com/
http://users.pandora.be/patrick_allaert/

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.