NAME

Template::Magic::Slicer - HTML Slicer for Template::Magic

VERSION 1.0

Included in Template-Magic-Pager 1.0 distribution.

The latest versions changes are reported in the Changes file in this distribution.

The distribution includes:

  • Template::Magic::Pager

    HTML Pager for Template::Magic

  • Template::Magic::Slicer

    HTML Slicer for Template::Magic

INSTALLATION

Prerequisites
Perl version    >= 5.6.1
Template::Magic >= 1.2
OOTools         >= 1.71
Standard installation

From the directory where this file is located, type:

perl Makefile.PL
make
make test
make install

Note: The installation of this module runs an automatic version check connection which will warn you in case a newer version is available: please don't use old versions, because I can give you full support only for current versions. Besides, since CPAN does not provide any download statistic to the authors, this check allows me also to keep my own installation counter. Version checking is transparent to regular users, while CPAN testers should skip it by running the Makefile.PL with NO_VERSION_CHECK=1.

SYNOPSIS

use Template::Magic::Slicer ;

$pager = Template::Magic::Slicer->new
         ( total_results   => $results         # ARRAY ref
         , page_number     => $page_number     # integer
         , rows_per_page   => $rows_per_page   # integer
         , pages_per_index => $pages_per_index # integer
         ) ;

and inside the 'pager' block in your template file you will have availables the complete set of "Labels and Blocks" supplied by Template::Magic::Pager, plus the page_rows block, that is the current page slice of the results.

DESCRIPTION

This module is a sub-class of Template::Magic::Pager, so you should start to read Template::Magic::Pager. Template::Magic::Slicer implements a couple of differences from its base class, which are useful when you already have all the results in memory.

Note: If you have big number of results coming from a DB query you should use the Template::Magic::Pager which is written exactly for that situation.

  • A simple and useful navigation system between my modules is available at this URL: http://perl.4pro.net

  • More practical topics are probably discussed in the mailing list at this URL: http://lists.sourceforge.net/lists/listinfo/template-magic-users

METHODS

new( arguments )

As Template::Magic::Pager::new(), this method returns the new object reference ONLY if there are results to display (see total_results below). It accepts the same arguments of its super class with only this difference:

  • total_results

    Mandatory argument. It must be a reference to the array of results you want to split into pages (not to be confused with the results of one page). If the referenced array does not contain any element, then the new() method will return the undef value instead of the object, thus allowing you to define a NOT_pager block that will be printed when no result has been found.

Labels and Blocks

This module adds one block to the standard Template::Magic::Pager set of Labels and Blocks:

  • page_rows (block)

    This block will be automatically used by Template::Magic to generate the printing loop with the slice of results of the current page.

SEE ALSO

Template::Magic::Pager

SUPPORT

Support for all the modules of the Template Magic System is via the mailing list. The list is used for general support on the use of the Template::Magic, announcements, bug reports, patches, suggestions for improvements or new features. The API to the Magic Template System is stable, but if you use it in a production environment, it's probably a good idea to keep a watch on the list.

You can join the Template Magic System mailing list at this url:

http://lists.sourceforge.net/lists/listinfo/template-magic-users

AUTHOR and COPYRIGHT

© 2004 by Domizio Demichelis (http://perl.4pro.net)

All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 152:

Non-ASCII character seen before =encoding in '©'. Assuming CP1252