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.

eZ debug

Timing: Jan 18 2025 05:13:50
Script start
Timing: Jan 18 2025 05:13:50
Module start 'layout'
Timing: Jan 18 2025 05:13:50
Module start 'content'
Timing: Jan 18 2025 05:13:51
Module end 'content'
Timing: Jan 18 2025 05:13:51
Script end

Main resources:

Total runtime0.6898 sec
Peak memory usage4,096.0000 KB
Database Queries75

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.0625152.6406
Module start 'layout' 0.00450.0022 740.703139.4766
Module start 'content' 0.00670.6816 780.1797685.1641
Module end 'content' 0.68820.0015 1,465.343816.1250
Script end 0.6898  1,481.4688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4668160.0002
Check MTime0.00130.1909160.0001
Mysql Total
Database connection0.00060.093910.0006
Mysqli_queries0.625590.6802750.0083
Looping result0.00070.1023730.0000
Template Total0.663796.220.3319
Template load0.00190.281220.0010
Template processing0.661895.935620.3309
Template load and register function0.00030.046210.0003
states
state_id_array0.00080.120810.0008
state_identifier_array0.00180.254720.0009
Override
Cache load0.00170.2517580.0000
Sytem overhead
Fetch class attribute can translate value0.00100.137850.0002
Fetch class attribute name0.00100.150980.0001
XML
Image XML parsing0.00100.151250.0002
class_abstraction
Instantiating content class attribute0.00000.002990.0000
General
dbfile0.00070.1009170.0000
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs