Andrew Maltsev > XAO-Web-1.07 > XAO::DO::Web::MultiPageNav

Download:
XAO-Web-1.07.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 2.001   Source  

NAME ^

XAO::DO::Web::MultiPageNav - Multi page navigation display

SYNOPSYS ^

Currently is only useful in XAO::Web site context.

DESCRIPTION ^

The 'MultiPageNav' object is a part of some 'Search' object that displays a header template, a search results template for each search result, and a footer template. The header and footer templates includes MultiPageNav object. There are three parameters available for substitution: START_ITEM, ITEMS_PER_PAGE and TOTAL_ITEMS. These parameters can be used to display subsequent links with the MultiPageNav object

The parameters for the MultiPageNav object are defined as follows:

start_item - Count of first item of current page

Note: count of first item of first page is 1.

items_per_page

Maximum number of items per page

total_items

Total number of items

n_edge_pages

Maximum number of first few and last few numbered page links

n_adjacent_pages

Maximum number of numbered page links immediately preceding and following current page

n_block_pages

Maximum number of numbered page links in blocks between 'edge' and 'adjacent' links

max_blocks

Maximum number of page link blocks (not including 'edge' and 'adjacent' links)

min_period

Minimum number of pages between blocks

previous_page.path

Path to template for displaying link to previous page

noprevious_page.path

Path to template for display when there is no previous page

next_page.path

Path to template for displaying link to next page

nonext_page.path

Path to template for display when there is no next page

current_page.path

Path to template for displaying (non)link to current page

numbered_page.path

Path to template for displaying link to numbered pages

spacer.path

Path to template for displaying spacer between numbered page links

path

Path to template for displaying all multi-page nav links

The 'MultiPageNav' object performs all necessary calculations and template substitutions (using xxx.path templates). The values for these parameters so that a list of parameters is available to the 'path' template. The values for this parameters correspond to the navigation display content. Following is a listing of said parameters with a description of thier values' display contents:

PREVIOUS

Link to previous page

FIRSTFEW

Links to first few pages

PREVIOUS_BLOCKS

Blocks of links to pages between first few and previous adjacent pages includingspacers

PREVIOUS_ADJACENT

Links to pages immediately preceding current page

CURRENT

(Non)link to current page

NEXT_ADJACENT

Links to pages immediately following current page

NEXT_BLOCKS

Blocks of links to pages between next adjacent and last few pages including spacers

LASTFEW

Links to last few pages

NEXT

Link to next page

The CGI parameters that are necessary for creating links in the 'xxx.path' templates are available via XAO::DO::Web::Utility object. Also, the following parameters available to these templates:

PAGE_START_ITEM

The count of the first item to appear on the page the link points to

PAGE_NUMBER

The page number the link points to

PAGE_TYPE

Type of page the link points to. Values can be PREVIOUS, FIRSTFEW, PREVIOUS_BLOCKS, PREVIOUS_ADJACENT, CURRENT, NEXT_ADJACENT, NEXT_BLOCKS, LASTFEW, NEXT

EXAMPLE ^

This example shows how a header or footer template might use this object:

 <%MultiPageNav
   start_item="<%START_ITEM%>"
   items_per_page="<%ITEMS_PER_PAGE%>"
   total_items="<%TOTAL_ITEMS%>"
   n_adjacent_pages="2"
   n_edje_pages="3"
   n_block_pages="2"
   max_blocks="4"
   min_period="7"
   path="/bits/multi_page_nav/base"
   previous_page.path="/bits/multi_page_nav/prev"
   next_page.path="/bits/multi_page_nav/next"
   current_page.path="/bits/multi_page_nav/current"
   numbered_page.path="/bits/multi_page_nav/page"
   spacer.path="/bits/multi_page_nav/spacer"
 %>

File /bits/multi_page_nav/page contents:

<A HREF="/search.html?<%Utility mode="pass-cgi-params" params="*" except="start_item" result="query" %>&start_item=<%PAGE_START_ITEM%>"><%PAGE_NUMBER%></A>

File /bits/multi_page_nav/prev contents:

<A HREF="/search.html<%Utility mode="pass-cgi-params" params="*" except="start_item" result="query" %>&start_item=<%PAGE_START_ITEM%>">&lt;&lt;prev</A>

File /bits/multi_page_nav/spacer contents: ...

File /bits/multi_page_nav/current contents:

[<%PAGE_NUMBER%>]

File /bits/multi_page_nav/base contents:

<%PREVIOUS%> <%FIRSTFEW%> <%PREVIOUS_BLOCKS%> <%PREVIOUS_ADJACENT%> <%CURRENT%> <%NEXT_ADJACENT%> <%NEXT_BLOCKS%> <%LASTFEW%> <%NEXT%>

If the value of START_ITEM, ITEMS_PER_PAGE and TOTAL_ITEMS are 250, 10 and 500 respactively text representation result of this example looks like

<<prev 1 2 ... 11 12 ... 22 23 24 [25] 26 27 28 ... 38 39 ... 49 50 next>>

METHODS ^

No publicly available methods except overriden display()

EXPORTS ^

Nothing

AUTHOR ^

Copyright (c) 2003-2005 Andrew Maltsev

<am@ejelta.com> -- http://ejelta.com/xao/

Copyright (c) 2001-2003 Marcos Alves, XAO Inc.

SEE ALSO ^

Recommended reading: XAO::Web, XAO::DO::Web::Page, XAO::DO::Web::CgiParam, XAO::DO::Web::Utility.

syntax highlighting: