Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Go to previous page / next page


Go to End


2 Posts   1778 Views

Avatar
Bereusei

Community Member, 96 Posts

26 February 2011 at 12:13am

Hallo folks,

I have used this tutorial http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/.
But it doesn´t work how I want. I want that you can only switch between Subsubpage 1 and 2 (see example of the sidetree)

- Page 1
- - Subpage 1 <- prev/next buttons are placed here
- - - Subsubpage 1
- - - Subsubpage 2

- - Subpage 2
- - Subpage 3

If I click on subsubpage2 on the next button, I jump to the startpage.
If I´am on subsubpage 2 to next button must not be shown.
Is it possible to set an if-statement for the control?

<% if nextpage or something %>
<% control PrevNextPage(next) %>
<a href="$Link" title="Go to $Title">next page</a></ br>
<% end_control %>
<% end_if %>

How can I check, if there is an "next-page" ?

Thanks for help.

Avatar
Bereusei

Community Member, 96 Posts

26 February 2011 at 10:36pm

I´ve found the solution:

<% control PrevNextPage(prev) %>
<% if LinkOrCurrent = link %>
<a href="$Link" title="Go to $Title" class="$LinkingMode"> < </a></ br>
<% end_if %>
<% end_control %>

<% control PrevNextPage(next) %>
<% if LinkOrCurrent = link %>
<a href="$Link" title="Go to $Title" class="$LinkingMode"> > </a></ br>
<% end_if %>
<% end_control %>

That works fine!