Next and previous links to Pages/nodes on same level
Hi,
In my Umbraco 4 site I have the following structure:
Sub section
- Sub page A
- Sub page B
Sub section
- Sub page C
- Sub page D
On the sub pages I want to have links at the bottom that look like this, say for example if I am on Sub page B I want to see the following at the bottom of the page:
<<Previous Sub Page A space Sub Page C Next >>
Previous and Next will be links that take you to the pages and the page names will just be labels. Is this possible and if so what would the XSLT look like. Many thanks.
Thanks for the response, I have used your code as follows:
[code]
[/code]
But this does not allow me to jump between the sub sections it just shows links to the ones in the same sub section. Also I need a way to exclude pages that don't have a true/false checkbox checked. Any idea's as to how I could acheive this? Many thanks
Anyone got any suggestions on this? I'm more interested in making it so that it only shows a link to pages that have a true/false checkbox checked. I can live without the showing nodes in other sub sections for now.
Ok the next part of that one works fine (it gets to the end and doesn't throw an error) but the previous part always shows a link to the first node rather than the one that precedes the current node. Also I need to work out how to get it to check if the true/false checkbox is checked, so hopefully I could incorporate what petr suggested somehow?
Your code does work to a certain extent, if I check the true/false box then it makes that page show up on the "previous-next" link but if I am then to uncheck the box then that page stays on the "previous-next" link rather than getting removed (almost as if it is caching the fact that the checkbox was previously checked).
Also the code doesn't show pages in other sub sections on the current section, I can live without this though if it is not possible. Many thanks
It looks like isch checkbox related problem. My code is for standard yes/no radiobutton (in fact i don't use it much, but it should be :-)
try test (debug) umbracoNaviHide and modify condition if necessery.
Sorry you've completely lost me, maybe its because its Friday! What is "isch checkbox related problem" and what is "test (debug) etc etc" and how do I implement it?
Is there anyone out there that can help with this one? I thought we almost seemed to get there then thing went quiet. Basically I want a Previous and Next navigation that takes me through pages they have a true/false checkbox checked. These pages are in different subfolders but maybe the XSLT could just search all the pages in the site that have the checkbox checked or is this not recommended?? I appreciate any advice anyone can offer.
Thanks for the response, I had pretty much given up on this thread and didn't receive an email notification from it so it was only by chance that I noticed your reply.
I tried the code below and once again it seems to show next and previous links to nodes that did at one time had the checkbox checked even though it is no longer checked. It only shows nodes in the same sub folder.
Sorry maybe I'm being a bit stupid but I'm not sure where I should add that code and what it is trying to acheive? Do I add it to the XSLT I already have or add it instead of it? Thanks for the help
Hi it dosn't metter, you can add it before previous xslt, it only shows all nodes and it's property value. Maybe we can then modify condition of previous xslt to work
Next and previous links to Pages/nodes on same level
Hi,
In my Umbraco 4 site I have the following structure:
Sub section
- Sub page A
- Sub page B
Sub section
- Sub page C
- Sub page D
On the sub pages I want to have links at the bottom that look like this, say for example if I am on Sub page B I want to see the following at the bottom of the page:
<<Previous Sub Page A space Sub Page C Next >>
Previous and Next will be links that take you to the pages and the page names will just be labels. Is this possible and if so what would the XSLT look like. Many thanks.
Take a look here
http://www.nibble.be/?p=44
Petr
Hi Petr,
Thanks for the response, I have used your code as follows:
[code]
[/code]
But this does not allow me to jump between the sub sections it just shows links to the ones in the same sub section. Also I need a way to exclude pages that don't have a true/false checkbox checked. Any idea's as to how I could acheive this? Many thanks
Anyone got any suggestions on this? I'm more interested in making it so that it only shows a link to pages that have a true/false checkbox checked. I can live without the showing nodes in other sub sections for now.
If you want showing nodes from others sections tim's code will be easyer to modify.
And for checkbox simply add condition [string(data [@alias='umbracoNaviHide']) != '1']
like this
Haven't tested this but according to xpath specs, you should be able to do something like this:
[code]
select="$currentPage/preceding::node[@level=$currentPage/@level][last()]" />
select="$currentPage/following::node[@level=$currentPage/@level][1]" />
[/code]
Regards
Jesper Hauge[size=6][/size]
I did try Tim's code but it kept throwing up an error about $itemindex when I tried to save it.
Thanks jhauge, I tried the code you specified, it does work until you get onto the last node then it throws up an XSLT error.
Again haven't tested this, but you probably need to check if previous and next node actually exists before trying to render the values of the nodes
How about this:
[code]
[/code]
.Hauge
Ok the next part of that one works fine (it gets to the end and doesn't throw an error) but the previous part always shows a link to the first node rather than the one that precedes the current node. Also I need to work out how to get it to check if the true/false checkbox is checked, so hopefully I could incorporate what petr suggested somehow?
[code]
[/code]
Doesn't work?
Hi Petr,
Your code does work to a certain extent, if I check the true/false box then it makes that page show up on the "previous-next" link but if I am then to uncheck the box then that page stays on the "previous-next" link rather than getting removed (almost as if it is caching the fact that the checkbox was previously checked).
Also the code doesn't show pages in other sub sections on the current section, I can live without this though if it is not possible. Many thanks
It looks like isch checkbox related problem. My code is for standard yes/no radiobutton (in fact i don't use it much, but it should be :-)
try test (debug) umbracoNaviHide and modify condition if necessery.
Petr
Sorry you've completely lost me, maybe its because its Friday! What is "isch checkbox related problem" and what is "test (debug) etc etc" and how do I implement it?
Any other suggestions on how to get this to work?
Hi again,
Is there anyone out there that can help with this one? I thought we almost seemed to get there then thing went quiet. Basically I want a Previous and Next navigation that takes me through pages they have a true/false checkbox checked. These pages are in different subfolders but maybe the XSLT could just search all the pages in the site that have the checkbox checked or is this not recommended?? I appreciate any advice anyone can offer.
HI,
try start with check property value of your checkbox
And you see what is in your umbracoNaviHide property.
Then you can modify condition in xslt if
Petr
Hi Petr,
Thanks for the response, I had pretty much given up on this thread and didn't receive an email notification from it so it was only by chance that I noticed your reply.
I tried the code below and once again it seems to show next and previous links to nodes that did at one time had the checkbox checked even though it is no longer checked. It only shows nodes in the same sub folder.
Ok,
lets try see what value(s) are in your property
Hi Petr,
Sorry maybe I'm being a bit stupid but I'm not sure where I should add that code and what it is trying to acheive? Do I add it to the XSLT I already have or add it instead of it? Thanks for the help
Hi it dosn't metter, you can add it before previous xslt, it only shows all nodes and it's property value. Maybe we can then modify condition of previous xslt to work
is working on a reply...