[Fwd: [ic] Scripting inside IC Tags]
Frank
interchange-users@icdevgroup.org
Thu Sep 19 20:52:01 2002
"Barry Treahy, Jr." wrote:
>
> Frank wrote:
>
> >Hello List,
> >
> >after getting caught in the mailinglist-archives without result
> >here now my as I think simple question:
> >
> >I want to randomize a loop search within a page every time the page
> >will be refreshed. So I only have to change the search-value
> >(5 possible values a-e) within the loop-search.
> >
> >I tried the following:
> >
> >1. perl version
> > [loop search="se=
> > [perl interpolate=1]
> > @tmp = (a,b,c,d,e)
> > srand();
> > $num = int(rand 5);
> > $out = $tmp[$num];
> > $out;
> > [/perl]
> > /sf=cat/ml=1"]
> >
> > --> nothing happens, even with generating the hole [loop search....]
> > by the script -> no output (seems to me the rand function
> > is not supported.(?))
> >
> >
> >
> The JS path is dead as it executes on the browser and not the server.
--> I should have known that -;-))
> Is there a reason you don't use the random parameter for loop?
--> I use mvend 3.14 and I already use the random thing for somewhat else...
> Either create a scratch variable from the results which the search loop uses or nest the two?
>
> Barry
>
> --
>
> Barry Treahy, Jr * Midwest Microwave * Vice President & CIO
>
> E-mail: Treahy@mmaz.com * Phone: 480/314-1320 * FAX: 480/661-7028
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
ThanX for your help, I think I got it now:
[loop search="se=[perl interpolate=1]
$tmp = localtime;
$txt = 'a';
if ($tmp =~ /0 2002$/) {$txt = 'a'}
if ($tmp =~ /1 2002$/) {$txt = 'b'}
if ($tmp =~ /2 2002$/) {$txt = 'c'}
if ($tmp =~ /3 2002$/) {$txt = 'd'}
if ($tmp =~ /4 2002$/) {$txt = 'e'}
if ($tmp =~ /5 2002$/) {$txt = 'f'}
if ($tmp =~ /6 2002$/) {$txt = 'g'}
if ($tmp =~ /7 2002$/) {$txt = 'h'}
if ($tmp =~ /8 2002$/) {$txt = 'i'}
if ($tmp =~ /9 2002$/) {$txt = 'j'}
$out = $txt;
$out;
[/perl]/sf=cat/ml=1"]
not very elegant - but it works!
Best regards,
Frank