Okay, so after being a bit confused about how to get this going at first I've come up with a solution to a problem I've been having today.
I'm building a new site, its going to be on a flash front end, but part of the requirment is that the site must also be avalible in a html version. (for non flash clients, and also so the content can be easily sent out to people).
Due to the design, we can only display 6, of an infinite number of content items on a page.
Starting Node (page number, minus 1, multiply that number by 6 and then add 1)
Finishing Node (page number multiplied by 6)
so I called these, $nodeStart and $nodeFinish
and we need a page number, so thats just a query string. nice and easy to do.
-
This is all great, and nearly works, but I'm having trouble setting the nodeFinish. The probem is how do you filter the for-each, something like 'position=7'? I'm right in thinking this can't be done at the for-each level, as that wouldn't make sense. It needs to be done after as a filter right?
I'm sure its really simple to do... probally just 2 words, and a number!
I've posted the code below, so anyone can have a gander... I was quite suprised that I couldn't find any code to similar effect up on the forum. (I wrote a little bit of code to deal with what happens when there is no query string passed. Which would always be page 1.)
If your interested in seeing how this behaves follow these links;
I tried the examples above, but using copy/paste gives a lot of errors. Seems like it is a problem with “ and ‘ when coping from the webpage. Is the “pure” code available anywhere?
XSLT Paging
Okay, so after being a bit confused about how to get this going at first I've come up with a solution to a problem I've been having today.
I'm building a new site, its going to be on a flash front end, but part of the requirment is that the site must also be avalible in a html version. (for non flash clients, and also so the content can be easily sent out to people).
Due to the design, we can only display 6, of an infinite number of content items on a page.
So we need some kinda of paging system...
-
This is my idea...
6 Items a page,
Page 1 = Items 1 -> 6
Page 2 = Items 7 -> 12
Page 3 = Items 13 -> 18
Page 4 = Items 19 -> 24
So what we need is two variables,
Starting Node (page number, minus 1, multiply that number by 6 and then add 1)
Finishing Node (page number multiplied by 6)
so I called these, $nodeStart and $nodeFinish
and we need a page number, so thats just a query string. nice and easy to do.
-
This is all great, and nearly works, but I'm having trouble setting the nodeFinish. The probem is how do you filter the for-each, something like 'position=7'? I'm right in thinking this can't be done at the for-each level, as that wouldn't make sense. It needs to be done after as a filter right?
I'm sure its really simple to do... probally just 2 words, and a number!
I've posted the code below, so anyone can have a gander... I was quite suprised that I couldn't find any code to similar effect up on the forum. (I wrote a little bit of code to deal with what happens when there is no query string passed. Which would always be page 1.)
If your interested in seeing how this behaves follow these links;
http://dev.voodoodog.com/commercialsidents.aspx (no page ID)
http://dev.voodoodog.com/commercialsidents.aspx?Page=1 (start position working, but not finish)
http://dev.voodoodog.com/commercialsidents.aspx?Page=2 (start position working, but not finish)
-
[code]
COUNT EQUALS
QS =
Node Start =
Node Finish =
[/code]
Comment author was deleted
You can find some xslt paging examples here: http://www.nibble.be/?p=11
I tried the examples above, but using copy/paste gives a lot of errors. Seems like it is a problem with “ and ‘ when coping from the webpage. Is the “pure” code available anywhere?
Hmm, that is pure code. I'd suggest a global search replace on those chars and you're set!
Regards,
/Dirk
Have a look at my example that I just posted that is adapted from the Nibble code. I did all the hard work of escaping! o:)
Works great =d>
I kept hitting new errors - nice work
is working on a reply...