hello, i tried a lot of solutions but without any success yet..
i have Projects node and under it project items. in the projects template i have XSLT macro that displays the project list, like a image gallery.(each page need to contains 6 projects: 2 rows with 3 projects each.)
because i'm using css and jquery (for pagegnation), i need to travel on all the projects nodes and to determine exactly where i am in the loop:
1. i need to know in which column i am (left,middle,right)
2. i need to know in which row i an (top or bottom).
3. i need to know in which page i am (every 6 projects it is a new page).
i succeded to acomplish the first mission using this loop:
To work out what page you are on, you could use a page variable in your querystring, e.g. page=3
The in your xslt you read the page number, and use that to determine which set of results to show, i.e. (defaulting page number to 1 if no querystring value specified):
Note: totally untested code but should get you on the right track!
<xsl:if test="position() > ($page-1 * 6) and position <= ($page * 6)>
<!-- you are on the current page of results - insert your column code here --> <xsl:if test="position() == ($page-1 * 6) + 1)"> <!-- top row --> </xsl:if> <xsl:if test="position() == ($page * 6)"> <!-- bottom row --> </xsl:if>
thanks, i wanted to make that with client side pagination and not server side. i have some new idea and i need to try it. ifd i will not succeed, i will post here simpler example and maybe my problem will be more clear to you.
You can still use the same idea client-side - instead of using a querystring to pass about the current page number, use your jquery. The logic above should still work - you could start a new div every six items and give it an id, e.g. page1, page2, etc. Then your jquery just needs to show/hide the correct divs each time a next/prev button is clicked.
Good luck with it! Look forward to seeing your final solution.
at the end i managed to solve the problem by using some trick that i saw here in the forum. after i figured out that i must use modulu to know "where i am" in the grid , the main problem was that i have to open and close DIV's in different positions in the loop, and that cause XSL errors. so i defined variables like this:
Stuck With Display of gallery items..
hello, i tried a lot of solutions but without any success yet..
i have Projects node and under it project items. in the projects template i have XSLT macro that displays the project list, like a image gallery.(each page need to contains 6 projects: 2 rows with 3 projects each.)
because i'm using css and jquery (for pagegnation), i need to travel on all the projects nodes and to determine exactly where i am in the loop:
1. i need to know in which column i am (left,middle,right)
2. i need to know in which row i an (top or bottom).
3. i need to know in which page i am (every 6 projects it is a new page).
i succeded to acomplish the first mission using this loop:
but inside that loop i need to determine if i'm in the top or bottom row, and if i'm in a new page (6 projects per page).
how can i do that?? i spent a lot of time trying many options. if someone can help it will be awsome.
thanks!
To work out what page you are on, you could use a page variable in your querystring, e.g. page=3
The in your xslt you read the page number, and use that to determine which set of results to show, i.e. (defaulting page number to 1 if no querystring value specified):
Note: totally untested code but should get you on the right track!
Then in your loop:
P.S. I would suggest creating a local variable to store the number of items to display per page, so you can easily update it, e.g.
<xsl:variable name="ITEMS_PER_PAGE" select="6"/>
Then you can update the number of items to display per page with a single update, rather than a global replace :)
thanks, i wanted to make that with client side pagination and not server side. i have some new idea and i need to try it. ifd i will not succeed, i will post here simpler example and maybe my problem will be more clear to you.
thanks.
You can still use the same idea client-side - instead of using a querystring to pass about the current page number, use your jquery. The logic above should still work - you could start a new div every six items and give it an id, e.g. page1, page2, etc. Then your jquery just needs to show/hide the correct divs each time a next/prev button is clicked.
Good luck with it! Look forward to seeing your final solution.
hello,
at the end i managed to solve the problem by using some trick that i saw here in the forum.
after i figured out that i must use modulu to know "where i am" in the grid , the main problem was that i have to open and close DIV's in different positions in the loop, and that cause XSL errors. so i defined variables like this:
and use them in the xsl like that:
thanks
is working on a reply...