Thorsten Scherler schrieb: > On Sat, 2007-09-22 at 14:45 +0000, [EMAIL PROTECTED] wrote: >> Hi, > > > Hi James, > > http://cocoon.apache.org/2.1/userdocs/concepts/actions.html > > I reckon you can use a "simple" action to extract a random link and the > pass it to the xsl via a sitemap parameter.
For a non-Java solution, you could use the random number input module (http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/modules/input/RandomNumberModule.html) and pass the number to an XSLT which operates on the sitetree. You can use the modulo operator with the number of existing nodes in the sitetree to select the document. This approach will be terribly slow compared to a Java-based solution as suggested by Thorsten. Anyway, I'd recommend an input module instead of an action (less code in the sitemap). -- Andreas > > This way the features described by solprovider should be easy to > implement with a nice java component. > > salu2 > >> Some interesting ideas here! >> >> It doesn't have to be strictly "Page of the day" ("Page of the browser >> refresh" is fine for our purposes). It would just be leaves, not >> categories, doesn't have to include every page of a certain document >> type but rather a hand-picked selection and doesn't have to be >> especially random. >> >> I was thinking of a manually updated file of page URLs maintained by the >> administrator with a bit of JavaScript(?) that picks a "random" URL from >> the file and 'somehow' extracts the page title (for use as link text) and >> the correct thumbnail filename (which should be easy as the primary image >> filename is a subset of the page URL). >> >> Regards, >> >> James >> >> P.S., You are aware that XSLT is Turing-complete aren't you ;-) Jesting >> aside, thanks for your HOWTO pages, I refer to them frequently. >> >> On Fri, 21 Sep 2007, [EMAIL PROTECTED] wrote: >> >>> Date: Fri, 21 Sep 2007 14:08:27 -0400 >>> From: [EMAIL PROTECTED] >>> Reply-To: user@lenya.apache.org >>> To: user@lenya.apache.org >>> Subject: Re: Random page of the day script >>> >>> "Page of the Day" implies daily update so the update function should >>> be scheduled once each day. Cache the pagelet. Delete the homepage >>> from cache so it updates to include the new material.. >>> >>> The selection should exclude the homepage. Only include leaves or >>> should category pages be included? Should editors set a flag on pages >>> that should be included? Maintain list of previously chosen pages to >>> prevent frequent repeats. How many items on recently used list? >>> >>> Use XMAP and XSL to create list of possible pages. Add a random >>> number to each item. Use the page with the lowest number. >>> >>> The main design decision is how to create the random numbers. A >>> completely XSL solution would be fun, but a custom transformer that >>> adds a "random" attribute to every element (excluding root) would be >>> simple. >>> >>> solprovider >>> >>> On 9/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>>> We want to provide a thumbnail on the home-page which represents and links >>>> to a random page of the day under Lenya. The random pages don't >>>> necessarily have to selected "live" (I was thinking of dumping the URLs >>>> to a file periodically and making some sort of script to select one). >>>> >>>> So, has anyone done something similar? What's the easiet way to do it? >>>> >>>> Cheers, >>>> James >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >> -- >> >> "Hey Microsoft, where do you want to 'SCO' today?" :-) >> >> [EMAIL PROTECTED] >> SDF-EU Public Access UNIX System - http://sdf-eu.org >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> -- Andreas Hartmann, CTO BeCompany GmbH http://www.becompany.ch --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]