Forums / General / How to create paging need help

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

eZ debug

Timing: Jan 31 2025 04:15:34
Script start
Timing: Jan 31 2025 04:15:34
Module start 'content'
Timing: Jan 31 2025 04:15:34
Module end 'content'
Timing: Jan 31 2025 04:15:34
Script end

Main resources:

Total runtime0.1388 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 587.9219180.8438
Module start 'content' 0.00740.0049 768.765697.9609
Module end 'content' 0.01230.1265 866.7266526.2734
Script end 0.1388  1,393.0000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00392.7813200.0002
Check MTime0.00140.9915200.0001
Mysql Total
Database connection0.00070.479710.0007
Mysqli_queries0.093367.22021410.0007
Looping result0.00120.87371390.0000
Template Total0.126290.910.1262
Template load0.00100.706610.0010
Template processing0.125290.193010.1252
Override
Cache load0.00070.500010.0007
Sytem overhead
Fetch class attribute can translate value0.00090.649710.0009
XML
Image XML parsing0.00030.199610.0003
General
dbfile0.00684.9025200.0003
String conversion0.00000.005230.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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