Try our conversational search powered by Generative AI!

Random property

Vote:
 
Is there a way to pick up a random article from within a section? For our website we require random content within a section of our front page. Something along the lines of pointing the property to a newslist and pulling back a random news page. Many thanks, Jon
#12643
May 22, 2006 14:32
Vote:
 
By "from a section", do you mean the childre of a page? In that case you could use a standard page property, point it to somewhere (just like you'd do with a list), do a GetChildren, and use the random class to pick a number in that range. If a "section" is a tree, below a given point, you'll have to use some of the pagetree controls, or traverse it yourself, and pick the page in the same way (be aware that loading big trees could give you a performance problem.) /Steve
#14667
May 22, 2006 19:22
Vote:
 
Hi Steve, yes the basic idea is point a property at a news list and it would pick a page from one level below at random.
#14668
May 23, 2006 16:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.