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.

Archive /

Our old forums are still available as a read-only archive.

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

Provide Previews and Next buttons for pages


Go to End


3 Posts   1361 Views

Avatar
teejay

Community Member, 63 Posts

27 August 2008 at 12:13pm

Hi,

I have a small problem. I have created a Pageholder (TestHolder) with a couple of children (TestPage). If I am viewing a children page I would like to have links for the next and previews page. That means for the following structure:

Page 1 --> links to page 2 and page 4
Page 2 --> links to page 3 and page 1
Page 3 --> links to page 4 and page 2
Page 4 --> links to page 1 and page 3

How can I achieve this, because I have no idea how I can parse a Dataobject so that I can use it to get the needed data in the controller.

$dob = DataObject::get('InventoryPage','ParentID = ' . $this->ParentID)->toArray();
print_r ($dob[0]);

This ends up in the InventoryPage Object and I have no access on the protected properties :(

If i could get the informations from the resultset i could create view variables, but i haven't a clue how to do it.

Best regrads Thomas

Avatar
Liam

Community Member, 470 Posts

27 August 2008 at 3:08pm

You mean Previous, not preview?

Anyway, take a look at this for some help - http://doc.silverstripe.com/doku.php?id=recipes:previousornext

Avatar
teejay

Community Member, 63 Posts

27 August 2008 at 3:13pm

Edited: 27/08/2008 4:29pm

Oh sorry yes I mean previous

I take a look into it.

Thx for the link I try it tomorrow