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.