[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Refresh random number (solved)
At 08:49 AM 7/4/02 -0500, you wrote:
>Happy Fourth of July to all...
>
>I have the following code which I was hoping would display a random item
>image as a banner, one per each category. An image displays just fine,
>however it never changes on subsequent page displays. Is there a method to
>refresh the random number generator so that a new random selection is made
>each time the page is visited?
>
><tr>
>[loop
> random=1
> search="
> fi=products
> st=db
> sf=category
> se=[item-field category]
> sf=image
> se=[item-field image]
> ra=yes
> ml=1000
> rf=code,include
> "]
>
><td align="center"><img src="items/[item-field image]" width="150">
>[/loop]
></tr>
>
>Thanks.
>
>Greg
Found the solution (after I posted of course). Random selection works fine.
My loop code (copied from an example) is wrong for this application. Here
is the corrected loop code:
[loop
random=1
search="
fi=products
st=db
sf=category
se=[item-field category]
ml=1000
tf=category
rf=code,image
"]
<td align="center"><img src="items/[loop-param image]" width="150">
[/loop]
Aside from my loop search being incredibly wrong, I was using [item-field
image] instead of [loop-param image]. A related message from Kevin Walsh
gave me a clue on this.
Now I get a random image from each category to be used as a banner image
(or whatever).
Perhaps this will help someone else down the line.
Greg