Foren

Random or Sequential Image in Header

Richard R Dyer, geändert vor 16 Jahren.

Random or Sequential Image in Header

New Member Beitrag: 1 Beitrittsdatum: 14.03.08 Neueste Beiträge
I'm having to develop an internal website that mimicks our companies main intranet. Their header has an image in the upper right hand corner that either randomly alternates, or cycles through all the possible images. I've mimicked this with javascript without a problem but I'm not too positive on how to do it using Velocity (and the javascript method jsut doesn't look as clean).

I'm sure there is a way but there really just isn't that much documentation on something like this and I'm not very familiar with velocity syntax. Anything is appreciated, even if its links on some tutorials or code examples.

Note: Our corporate intranet isn't in LifeRay so I cna't simply look ath teir code base. I'm trying to mimic their theme with LifeRay. So far, this is the only problem I've had.
Radu Banica, geändert vor 15 Jahren.

RE: Random or Sequential Image in Header

New Member Beiträge: 11 Beitrittsdatum: 19.06.08 Neueste Beiträge
The template with ID RANDOM-IMAGE (name of the template is Random Image) that comes with the default portal bundle will display a random image from a pool of 10 images. You can add more images by modifying the related structure MULTIPLE-IMAGES.
Nick Dellas, geändert vor 15 Jahren.

RE: Random or Sequential Image in Header

New Member Beiträge: 2 Beitrittsdatum: 08.01.09 Neueste Beiträge
one simple solution (in order to insert a random image on the theme) is to first create a random number
e.g. #set ($imgnum = $mathTool.random(1,17) ) <-- random number 1...16
then append the number to image name
e.g. #set ($imgurl = "${images_folder}/custom/Banner${imgnum}.png")
and insert the image tag to the appropriate place
e.g. <img class="myImageCssClass" src="$imgurl" />
The only limitation is that all banners should placed on same folder (in theme) and their names must differ only to a number
thumbnail
John Voltaire Maximo, geändert vor 8 Jahren.

RE: Random or Sequential Image in Header

Regular Member Beiträge: 106 Beitrittsdatum: 19.06.15 Neueste Beiträge
any other solutions guys? is this the only approach to solve this problem??
thumbnail
David H Nebinger, geändert vor 8 Jahren.

RE: Random or Sequential Image in Header

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
Wow, this is the oldest zombie I've seen brought back to life in a long time - 8 1/2 years...

Seriously, whatever they were doing 8 years ago is likely not relevant. Try a new thread with your specific issue...
thumbnail
John Voltaire Maximo, geändert vor 8 Jahren.

RE: Random or Sequential Image in Header

Regular Member Beiträge: 106 Beitrittsdatum: 19.06.15 Neueste Beiträge
I just did sir,,, and you helped me with this HAHAHA!!
thanks,, I replied just now emoticon