Forums / Setup & design / Random banners in a page
Alfredo Cruz
Tuesday 11 November 2008 10:10:39 am
How can I make a page show different banners (images or flash) everytime it's requested?
For instance, I have a flash banner, and I want that flash banner to appear 90% of the time the page is loaded. The other 10%, I want another flash banner.
I also have an image, which I want it to appear 30% of the time, another image 30% of the time, and the final image 40%.
How can I accomplish that.
Thanks..!!
André R.
Wednesday 12 November 2008 12:41:39 am
Output all the banners as hidden HTML and show one using javascript, this way you won't have to disable any cache or anything.
If there are a lot of banners then this wouldn't work (to much markup) and something should be done using a count fetch(to get total) and random operator to select banner using the random number as offset for the fetch (with limitation 1). This needs to be done outside any cache though.
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription @: http://twitter.com/andrerom