Would it be helpful if i make i ticket in your JIRA system? -- Hay
2010/3/2 Grégory Joseph <[email protected]>: > > Hmm you're right, it's indeed not very clear by the documentation; the idea > was more to be able to keep on calling siblings.next() until you reach the > end, to generate navigation menus for example. I'm not sure it's used > anywhere to do that at the moment, so we could maybe either change its > behavior and/or introduce extra "read-only" methods. > > On Mar 2, 2010, at 10:58, Hay (Husky) wrote: > >> >> Well, after a little more digging i got to the root of the problem, >> which isn't what i thought it was at all. >> >> I was assuming that the internal pointer of the returned >> mgnl.siblings() object would stay at the current page, however, that's >> not the case. The first siblings.prev() in my original code set the >> pointer back to the previous page, so the next siblings.next() returns >> the current page. To correct the problem you could fix it by >> re-assigning the variable, so you get this code: >> >> [#assign siblings = mgnl.siblings(content) /] >> >> [#if !siblings.first] >> <a href="${mgnl.createLink(siblings.prev())}">Previous page</a> >> [/#if] >> >> [#assign siblings = mgnl.siblings(content) /] >> >> [#if !siblings.last] >> <a href="${mgnl.createLink(siblings.next())}">Next page</a> >> [/#if] >> >> This is a pretty big 'gotcha' for anyone working for this function, so >> i think the behaviour of the method should be changed to let the >> current pointer stay at the original index, or this behaviour should >> be properly documented. >> >> Regards, >> -- Hay >> Frontend developer VPRO Netherlands >> >> 2010/3/1 Grégory Joseph <[email protected]>: >>> >>> Hi Hay, >>> >>> Which sub-nodes are you referring to ? >>> >>> If you're doing this in a paragraph, ${content} refers to the current >>> paragraph's node. ${mgnl.siblings(content)} creates an instance of >>> "SiblingsHelper" based on the given node, which in turn, by defaults, uses >>> the given node's type to filter out which nodes it wants to navigate >>> to/from. Long story short, you probably want ${mgnl.siblings(page)} >>> instead. If that doesn't help, then we have a bug. >>> >>> Cheers, >>> >>> -g >>> >>> >>> On Mar 1, 2010, at 17:11, Hay (Husky) wrote: >>> >>>> >>>> Hi everyone, >>>> i'm trying to build a 'previous / next' navigation using the >>>> mgnl.siblings method in a Freemarker template. However, i'm running >>>> into some problems with this method. >>>> >>>> I'm requesting the siblings for the current page, and on the basis of >>>> that assign title and link to different values: >>>> >>>> [#assign siblings = mgnl.siblings(content) /] >>>> >>>> [#if !siblings.first] >>>> <a href="${mgnl.createLink(siblings.prev())}">Previous page</a> >>>> [/#if] >>>> >>>> [#if !siblings.last] >>>> <a href="${mgnl.createLink(siblings.next())}">Next page</a> >>>> [/#if] >>>> >>>> However, this seems to fail in sub-nodes because the sibling utility >>>> also uses other content nodes (such as the 'main' and 'extras' nodes) >>>> and tries to make links for that. Is there some way to force siblings >>>> to only get pages? >>>> >>>> Thanks, >>>> -- Hay >>>> Frontend developer VPRO Netherlands >>>> >>>> ---------------------------------------------------------------- >>>> For list details see >>>> http://www.magnolia-cms.com/home/community/mailing-lists.html >>>> To unsubscribe, E-mail to: <[email protected]> >>>> ---------------------------------------------------------------- >>> >>> >>> ---------------------------------------------------------------- >>> For list details see >>> http://www.magnolia-cms.com/home/community/mailing-lists.html >>> To unsubscribe, E-mail to: <[email protected]> >>> ---------------------------------------------------------------- >>> >>> >> >> ---------------------------------------------------------------- >> For list details see >> http://www.magnolia-cms.com/home/community/mailing-lists.html >> To unsubscribe, E-mail to: <[email protected]> >> ---------------------------------------------------------------- > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <[email protected]> > ---------------------------------------------------------------- > > ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
