You are here: How smart is smarty? « Smarty Templates Posts « IT news, forums, messages
How smart is smarty?

Posted by Barry Carter on 07/25/05 00:59

Can I use smarty in this scenario:

I have an array of 500 elements, where each element is a hash with the
firstname, lastname, address, favorite color, etc of a given person. 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".

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. For
example, if you're on page 10, you can jump to pages 7-9, 11-13, or the
first page (page 1) or the last page (in this case page 20), with maybe a
few more choices.

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.

I'd also like people to be able to re-order the columns and hide/unhide
columns, and give them a choice to see 50 or 75 rows at a time instead of
25.

Further, can all this be done if the data is in a MySQL table instead of
an array, and I want to efficiently use SQL statements like:

select viewable_columns from tabname order by colname limit page*25-24,25

for example (I'm guessing making MySQL calls blurs the line between
application presentation and application logic?)

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.

I know I can do this (and have done a lot of this) using PHP and MySQL
(and could perhaps make it better using JavaScript/ECMAscript), so my real
question is: can smarty do the above quickly and easily (perhaps using
built-in features or plug-ins someone else has already written), or will
this require just as much work regardless of whether I do it with or
without smarty?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация