How to create paging need help

Author Message

sangib das

Tuesday 22 August 2006 3:36:50 am

Hi
I have twenty articles on a folder named News.I wnat to show ten article on per page.
and there will be next and previous link.
1.First page it will dispay only first 10 article nad one Next link.
2.When click on Next link it will display other 10 article with previos link.
Thanks

Martin Lekvall

Tuesday 22 August 2006 4:39:08 am

Hi Sangib,

Check out the simple.tpl or google.tpl that comes with eZ publish. I think simple.tpl does exacly what you want, but google.tpl are more frequently used.
google.tpl is used in a lot of the standard templates so you have plenty of examples to look at, or copy and modify them to get the fetch-statements and view_parameters to fit your needs. (just grep -R 'navigator/google\.tpl' design/* if you are on *nix)

/Martin

EzP 3.5.0, OE 2.0
RH-EL3 2.4, mySql 4.1.7, php 4.3.9, apache 1.3.33

sangib das

Tuesday 22 August 2006 6:52:46 am

Hi Martin Lekvall

Thanks you for giving information.But i dont know how to set up
{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}
following file.............................................
please tell me how to set up this file
How to set up the following thing

1 page_uri=concat('/content/view','/full/',$node.node_id)
2 item_count=$list_count
3 view_parameters=$view_parameters
4 item_limit=$page_limit

pls see the following code
<table >

{section loop=fetch( content,list,hash( parent_node_id,303,

sort_by, $node.sort_array,limit,30 ) ) }

<tr>

{* Display the folder-name as a link to a full view of the node. *}

{if eq($node.node_id,$:item.node_id)}

<td width=15> <img src={"images/red_sarrow.gif"|ezdesign} ></td><td>

<a href={$:item.url_alias|ezurl} class=innerlinks> <b>{$:item.name}</b></a>

{else}

<td width=15> </td><td>

<a href={$:item.url_alias|ezurl} class=innerlinks> {$:item.name}</a>

{/if}

</td></tr>

{/if}

</b>

{* End of sub-folder loop. *}

{/section}

</table>

{include uri="design:google.tpl"

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

item_count=36

 

view_parameters=4

 

item_limit=3}

 

Kristian Hole

Tuesday 22 August 2006 9:07:03 am

Here is one example of how to use the navigator.

What you need to send to the navigator is
- the max number of items, to get the correct number of pages. the number is fetched with list_count
- the limit: how many items per page
- the url to the current page
- the view-parameters: for finding the offset/which element we are viewing/which page we are on.

{def $offset=0
     $limit=20}
{if is_set($view_parameters.offset)}
    {set $offset=$view_parameters.offset}
{/if}

{def $meny=fetch('content','list',
    hash( 'parent_node_id', $node.node_id,
        'limit', $limit,
        'offset', $offset ))}
{def $meny_count=fetch('content','list_count',
    hash( 'parent_node_id', $node.node_id ))}

{foreach $meny as $element}
    {node_view_gui content_node=$element view='line'}
{/foreach}


{include uri="design:navigator/google.tpl"
         page_uri=$node.url_alias
         item_count=$meny_count
         view_parameters=$view_parameters
         item_limit=$limit}

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

sangib das

Tuesday 22 August 2006 9:18:34 pm

Hi Kristian Hole
Thanks a lot. It is propely working.
Again thanks for giving correct coding and information.
thanks
Sangib

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 20 2025 01:08:57
Script start
Timing: Jan 20 2025 01:08:57
Module start 'layout'
Timing: Jan 20 2025 01:08:57
Module start 'content'
Timing: Jan 20 2025 01:08:57
Module end 'content'
Timing: Jan 20 2025 01:08:57
Script end

Main resources:

Total runtime0.0147 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.1484152.6250
Module start 'layout' 0.00560.0029 741.773439.4453
Module start 'content' 0.00850.0044 781.218893.4141
Module end 'content' 0.01280.0018 874.632838.3047
Script end 0.0146  912.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002315.8875140.0002
Check MTime0.00106.6335140.0001
Mysql Total
Database connection0.00085.403710.0008
Mysqli_queries0.002718.584530.0009
Looping result0.00000.252110.0000
Template Total0.00149.710.0014
Template load0.00085.273610.0008
Template processing0.00064.408210.0006
Override
Cache load0.00063.806410.0006
General
dbfile0.00021.397380.0000
String conversion0.00000.042340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs