Fórumok

Random or Sequential Image in Header

Richard R Dyer, módosítva 16 év-val korábban

Random or Sequential Image in Header

New Member Bejegyzés: 1 Csatlakozás dátuma: 2008.03.14. Legújabb bejegyzések
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, módosítva 15 év-val korábban

RE: Random or Sequential Image in Header

New Member Bejegyzések: 11 Csatlakozás dátuma: 2008.06.19. Legújabb bejegyzések
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, módosítva 15 év-val korábban

RE: Random or Sequential Image in Header

New Member Bejegyzések: 2 Csatlakozás dátuma: 2009.01.08. Legújabb bejegyzések
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, módosítva 8 év-val korábban

RE: Random or Sequential Image in Header

Regular Member Bejegyzések: 106 Csatlakozás dátuma: 2015.06.19. Legújabb bejegyzések
any other solutions guys? is this the only approach to solve this problem??
thumbnail
David H Nebinger, módosítva 8 év-val korábban

RE: Random or Sequential Image in Header

Liferay Legend Bejegyzések: 14918 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
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, módosítva 8 év-val korábban

RE: Random or Sequential Image in Header

Regular Member Bejegyzések: 106 Csatlakozás dátuma: 2015.06.19. Legújabb bejegyzések
I just did sir,,, and you helped me with this HAHAHA!!
thanks,, I replied just now emoticon