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.

Customising the CMS

Display Content from Random child Page (based on Count)


Reply

10 Posts   3146 Views

Avatar
tobych

10 November 2009 at 6:49pm Community Member, 97 Posts

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

Avatar
biapar

11 November 2009 at 12:04am Forum Moderator, 435 Posts

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