I have a list of movies with date of appearing and it's votes written in a variable or even in a file, dosen't matter. What I want to do is to split the list in some pages, to have 15 movies on a page, another 15 on th next page and so on till It's empty. I would like some sugestions on how should I complete this task. I have some ideeas of my own, but I want to see/compare mine with others.
Once the game is over, the king and the pawn go back in the same box.
a loop with a counter
then use the mathematic DIV cmd (if there is such a thing in TCL) to check if the counter is able to be divided trought 15 (alà if {[expr $ctr div 15] = 0})
if yes -> increase the page-jump-counter by one
Don't need a div command i would think. You could do two things, you could store it in a temp var and take away 15 every time until you either go negative/zero or detect that the number is below 15, depending on where u check. Or you could do normal division and check to see if the number was below or equal to 15...
Give me an example of how should I mess around inside the for loop. I've played with it and screwd it all the time. The thing is that inside this loop I got to store in a html file only 15 movies with ther coments, date and etc. then move to the next page and continue with other 15 and so on..
Once the game is over, the king and the pawn go back in the same box.
set ctr 1
set ctr2 0
set ctr3 0
while {$finished == 0} {
incr ctr
incr ctr3
if {$ctr == 15} {
set ctr 1
incr ctr2
}
set page($ctr2,$ctr) $movie($ctr3)
if {$ctr3 == $movies(count)} {set finished 1}
}
i'm sorry i cant test it right now, but i think it should work
the output will be an array (page) with page(1,3) == "Desperados" for example
the output into the html template shouldnt be a problem afterwards