[ic] accessing search vars in results page
Jon
interchange-users@icdevgroup.org
Wed Mar 26 22:15:00 2003
> Is there a way to way to access the search variables I used in the
> results page?
> Say I have a url like this
> /scan/se=mysearch/sf=category.html
> and I want to grab what I used for mv_search_field.
>
> I've tried [value mv_search_field] and it just spits out an asterisk.
> Do I have to grab and parse the url?
>
> Thanks,
>
> josh
>
This will be the second time I've posted this information which was
provided to
me by some other kind person out there. I hope it is what you're looking
for.
Jon
[if session last_search =~ /products/]
[seti lastsearch][data session last_search][/seti]
[perl]
my @sf;
my @se;
my $item;
my $cnt = 0;
my $tmpSearch = {};
my @searchstring = split(/\//,$Scratch->{lastsearch});
## build list of sf and se
foreach $item (@searchstring) {
if ($item =~ /^sf=(.*)/) {
push @sf,$1;
}
elsif ($item =~ /^se=(.*)/) {
push @se,$1;
}
}
## now build our hash of field/term pairs
foreach $item (@sf) {
$tmpSearch->{$item} = $se[$cnt];
$cnt++;
}
## populate needed scratch values
$Scratch->{lastbrand} = $tmpSearch->{brand};
$Scratch->{lastmaincat} = $tmpSearch->{maincat};
$Scratch->{lastsubcat} = $tmpSearch->{subcat};
return;
[/perl]
[/if]