set page block to display random blocks from within a specific folder

lauren.fraser's Avatar

lauren.fraser

06 Dec, 2010 11:17 PM

We currently have a Banner block that we use to display an image under our navigation.

For specific pages - we have a specific image (the News page has a news image).

For all other pages we have a folder of blocks that contain the images we would like to randomly populate to each page. Is there a way in Cascade to do this? So the user wouldn't have to choose a block when creating the page and Cascade would automatically assign 1 block out of the 20 or so that are in a specific folder in a random (or apparently random order).

  1. 1 Posted by Eric L. Epps on 07 Dec, 2010 05:41 PM

    Eric L. Epps's Avatar

    Not sure how deep into XSL you get, or what version you're on, but I would create a Data Definition Block, attaching the 20 blocks to a block chooser data definition. In the XSLT, then, you could use the Xalan JavaScript component to generate a random number and choose from among the attached blocks. (Here's Xalan used to convert a date: http://www.hannonhill.com/kb/RSS-Feed/)

    In fact, now that I think about it, there's a video from the user conference that describes a more complex, but more flexible, technique for doing just the kind of thing you're describing. http://www.hannonhill.com/news/conference/2010/videos/Dynamic-Asset...

  2. 2 Posted by lauren.fraser on 07 Dec, 2010 06:16 PM

    lauren.fraser's Avatar

    Thanks Eric. I'll take a look at these two resources. We're working fast and furious to get our site ready. So this may be something we implement after our go live.

  3. lauren.fraser closed this discussion on 11 Jan, 2011 05:51 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac