掲示板

Random or Sequential Image in Header

16年前 に Richard R Dyer によって更新されました。

Random or Sequential Image in Header

New Member 投稿: 1 参加年月日: 08/03/14 最新の投稿
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.
15年前 に Radu Banica によって更新されました。

RE: Random or Sequential Image in Header

New Member 投稿: 11 参加年月日: 08/06/19 最新の投稿
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.
15年前 に Nick Dellas によって更新されました。

RE: Random or Sequential Image in Header

New Member 投稿: 2 参加年月日: 09/01/08 最新の投稿
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
8年前 に John Voltaire Maximo によって更新されました。

RE: Random or Sequential Image in Header

Regular Member 投稿: 106 参加年月日: 15/06/19 最新の投稿
any other solutions guys? is this the only approach to solve this problem??
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Random or Sequential Image in Header

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
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
8年前 に John Voltaire Maximo によって更新されました。

RE: Random or Sequential Image in Header

Regular Member 投稿: 106 参加年月日: 15/06/19 最新の投稿
I just did sir,,, and you helped me with this HAHAHA!!
thanks,, I replied just now emoticon