Re: [Templates] paginator - newbie question
[prev]
[thread]
[next]
[Date index for 2004/05/22]
Dave et. al,
Previous post example has been a great help, forced me to learn my
data structures esp. hash arrays. I have question about output.
Last page should have the 7th rec. but 7th rec.is not showing.
What is cause? Shouldn't splice pick-up last record?
Don't know if you can see it but there's garbage
chars on the 1st line of output after every tpage(?)
I'm using a dos cmd line in Win2K.
See below. Again, Thanks.
.dat
-----
id : name : description
1 : one : number one
2 : two : the second number
3 : three : a third number
4 : four : number, the fourth
5 : five : numero cinco
6 : six : six (not sex)
7 : seven : lucky for some
.tt
-------
[% USE numbers = datafile('numbers.dat') -%] [% USE page =
Page(numbers.size, 3, currpage) -%] Page [% page.current_page %] of [%
page.last_page %] Entries [% page.first %] to [% page.last %] of [%
page.total_entries %]
[% FOREACH num = page.splice(numbers) -%] [% num.id %] [% num.name |
format('%-
8s') %] [% num.description %] [% END -%]
[% FOREACH num = numbers -%] [% num.id %] [% num.name | format('%-8s')
%] [% num.description %] [% END -%]
output
-------
A:\>tpage --define currpage=3 page.tt
Page 3 of 3
Entries 7 to 7 of 7
one number one
two the second number
three a third number
four number, the fourth
five numero cinco
six six (not sex)
seven lucky for some
A:\>tpage --define currpage=1 page.tt
Page 1 of 3
Entries 1 to 3 of 7
one number one
two the second number
three a third number
one number one
two the second number
three a third number
four number, the fourth
five numero cinco
six six (not sex)
seven lucky for some
A:\>
--
http://www.fastmail.fm - A no graphics, no pop-ups email service
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates