Jump to:

5521 Posts in 1733 Topics by 1220 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Display Content from Random child Page (based on Count)

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

Page: 1 2
Go to End
Author Topic: 3073 Views
  • tobych
    Avatar
    Community Member
    97 Posts

    Re: Display Content from Random child Page (based on Count) Link to this post

    Linsey,

    You're not actually getting a random child of a particular page here, of course. You're getting a random instance of a particular class. That's fine if all instances share the same parent.

    I've just used this code to generate a random testimonial on a home page: pretty much the same use case as you have, it appears.

    I can't offer code to produce a random child right now, as I'm too trying to get a site ready. Just wanted to warn people.

    Toby

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Display Content from Random child Page (based on Count) Link to this post

    I confirm this:

    "You're not actually getting a random child of a particular page here, of course. You're getting a random instance of a particular class. That's fine if all instances share the same parent. "

    Because tested... -

    Bye

    3073 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.