[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
RE: Beyond Remembering mv_searchspec
****** message to minivend-users from "Thompson-Jordan" <Thompson-Jordan@mindspring.com> ******
Well, I have found a way to redisplay a page with the same search parameters
that generated the page originally. The method is not particularly elegant,
but it works.
All I do is pass an mv_value variable that contains a copy all of the search
parameters and then patch it up so that I can use it again as the actual
search parameters. It can be used to create pages that can redisplay
themselves with different display settings. If you improve on this method or
find a better method, please let me know.
It was Mike's reply "If you generated the search parameters, you should be
able
to recreate them. 8-)" that go me thinking in this direction. Actually, it
was the "8-)" that tipped me off.
I have included an example below that controls sorting. The method is as
follows:
THE PAGE INITIATING THE SEARCH
Pass an mv_value var with a copy of all search parameters, except &
separated. So in my example, the value my_search contains the copy of the
parameters for scan. Minvend syntax junkies should note that the exact
formatting is important in this example, as is the formatting in other
examples below.
[page href="scan" arg="sf=category
sp=mypage
se=Impressionists
va=my_search=sf=category&sp=mypage&se=Impressionists"]Show
Impressionists[/page]
THE SEARCH RESULTS PAGE
1. Make a copy of my_search variable and change the &'s to newlines for use
later.
[perl arg="values" hide=1]
$Safe{'values'}{'my_searchtemp'} = $Safe{'values'}{'my_search'};
$Safe{'values'}{'my_searchtemp'} =~ s/\&/\n/g;
'';
[/perl]
2. In this example I am controlling the sort direction. I use two variables:
a scratch variable my_sort to maintain the sort setting globally and a
va_value variable my_sortspec that this page passes to itself to toggle
my_sort.
Here mv_sortspec is used to set my_sort. Note that if the calling page does
not pass my_sortspec, mv_sort is not changed and the current setting is
used.
[if value my_sortspec eq "Descending"]
[then]
[set my_sort]Descending[/set]
[/then]
[elsif value my_sortspec eq "Ascending"]
[set my_sort]Ascending[/set]
[/elsif]
[/if]
3. Show a link that will display this page again, but with a different sort
setting in mv_sortspec. The correct link is shown depending on mv_sort. Here
the var mv_searchtemp (which had the &'s changed to newlines) is used as the
actual list of search parameters. The var my_search (the & separated one) is
passed again so all of the original search parameters are maintained.
[if scratch my_sort eq "Descending"]
[then]
[page href=scan
arg="[value my_searchtemp]
va=my_sortspec=Ascending
va=my_search=[value my_search]"]
Sort Ascending[/page]
[/then]
[else]
[page href=scan
arg="[value my_searchtemp]
va=my_sortspec=Descending
va=my_search=[value my_search]"]
Sort Descending[/page]
[/else]
[/if]
3. The you can the use the scratch variable my_sort to control the sorting
in a [search-list] or for anything else on the page. Note that the default
way to display the page in the [else] so it works even if mv_sort in not
initialized. This example could probably be optimized to not have this huge
[if], but it shows the idea.
[if scratch my_sort eq "Descending"]
[then]
[search-list]
[sort products:title:r]
. . .
[/search-list]
[/then]
[else]
[search-list]
[sort products:title:f]
. . .
[/search-list]
[/else]
[/if]
Of course, a [page href="rescan" arg=" additional parameters "] would be
nice 8-).
Christopher Thompson
> -----Original Message-----
> From: owner-minivend-users@minivend.com
> [mailto:owner-minivend-users@minivend.com]On Behalf Of
> mikeh@minivend.com
> Sent: Wednesday, February 03, 1999 10:29 AM
> To: minivend-users@minivend.com
> Subject: Re: Beyond Remembering mv_searchspec
>
>
> ****** message to minivend-users from mikeh@minivend.com ******
>
> Quoting Thompson-Jordan (Thompson-Jordan@mindspring.com):
> >
> > I understand how to use either standard Minivend or Perl to assign the
> > values of vars like mv_search_field into my variables (see
> below). But if
> > the values are null, there is no use in saving them. It makes sense that
> > Minivend clears them. But, is there a way to access these mv_
> vars after a
> > search.
>
> Not really. Since there can be multiple searches in a page, and
> many,many searches in a session, this would conceivably require storing
> a lot of search objects.
>
> >
> > As Frank correctly points out, [more-list] generates these
> searches. The URL
> > generated by [more-list] looks like:
> >
> >
> www.mysite.com/cgi-bin/vlink/scan/MM=29b28b7c7f0d4372b53eba:50:99:
> 50:?ABxz5m
> > y3;;42
> >
> > It looks like the search information is stuffed in the first
> parameter of
> > the mv_max_matches parameter (which might explain why some
> people have had
> > problems using mv_max_matches).
>
> MM is "mv_more_matches", mm is mv_max_matches. As Frank pointed
> out previously,
> mv_max_matches only applies to Glimpse. mv_matchlimit is the proper thing
> to set to limit search return.
>
> > However most of my pages don't have more
> > items than will fit on a page, hence no more-list. Any ideas on
> how to get
> > to this information?
> >
>
> If you generated the search parameters, you should be able
> to recreate them. 8-)
>
> [set last_search]
> se=whatever
> sf=whatever
> sp=whatever
> [/set]
>
> <A HREF="[area
> href=scan
> arg="[last_search]"
> ]">Last search</A>
>
> I will consider adding an option to save the search object even
> if no overflow condition is present. In fact, I thought I was doing
> that; but I guess I decided not to since the number of files created
> in the tmp/ directory could be very large.
>
> --
> Mike Heins http://www.minivend.com/ ___
> Internet Robotics |_ _|____
> Few blame themselves until they 131 Willow Lane, Floor 2 | || _ \
> have exhausted all other Oxford, OH 45056 | || |_) |
> possibilities. <mikeh@minivend.com> |___| _ <
> -- anonymous 513.523.7621 FAX 7501 |_| \_\
> -
> To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
> email with 'UNSUBSCRIBE minivend-users' in the body to
> Majordomo@minivend.com.
> Archive of past messages: http://www.minivend.com/minivend/minivend-list
>
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list