Re: [SMARTY] How smart is smarty?

Maximillian Schwanekamp <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
Barry Carter wrote:
> I want to display the first 25 rows in a table, and then have a button/link
> that says "next 25 rows"; the second page would display rows 26-50 with
> buttons/links for "previous 25 rows" and "next 25 rows".

Check out Monte Ohrt's SmartyPaginate plugin[0].  I've been using it in
a site-admin context for a few months, and it's been great.

> Additionally, I'd like a "jump to page" section at the bottom of the table
> that lets people jump immediately to page 7 (rows 151-175) or something,
> but this should be like EBAY-- not every page number should be listed...

In SmartyPaginate you can limit the number of links shown, IIRC it's
done with template markup, with the page_limit parameter for the
paginate_middle function.  What I do is have a link for "first page" at
the beginning of the paging links, "last page" at the end of them, and
in between there are up to 8 page links (with the current one in the
middle).

> I'd also like the table headers to make the list sortable, so people can
> sort (including descending sort) the list by address, firstname, or
> whatever they choose, with a default sort of lastname if no other sort is
> chosen.

SmartyPaginate does not do this.  In my case, I sort the results array
in the backend script according to parameters passed in the $_GET array.
  It could be argued that organization of datasets should be backend
work anyway.

> Finally, I'd like to save the user's preferences (re sort order, column
> order, which columns they want to see, how many rows they want to see at a
> time, etc) to a file or a cookie.

Saving/validating user prefs is really quite separate from database
paging, even if some of those preference values are used when creating
the paged data output.  Perhaps you should code that into your User
class, or perhaps someone else here has a better suggestion...

[0] http://www.phpinsider.com/php/code/SmartyPaginate/

-- 
Max Schwanekamp
http://www.neptunewebworks.com/

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.