[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Loop Search part 2 :)
****** message to minivend-users from Victor Nolton <ven@pragakhan.com> ******
I sended up using someone elses suggestion, which was look at the
browse page. I've copied the code and changed the page name. yet the
next and previous buttons act totally weird.
next is displayed on the first page, and on the second and previos is
displayed on the 3rd page. though on the last page there are a bunch
of extra rows with no data, but the formatting is there incase there
actually would be items.
Very odd. I guess I broke part of the simple demo
I call it with this..
<A HREF="[area href=seastories2 arg='0:12']">test</A>
[perl arg=scratch]
$start = tag_data('session', 'arg') || 1;
$chunk = 1;
if($start =~ /(\d+):(\d*)/) {
$start = $1;
$chunk = $2 || 1;
}
$prev = $start - $chunk;
if($prev < 1) {
$prev = 0;
}
$Safe{'scratch'}{'start'} = $start;
$Safe{'scratch'}{'chunk'} = $chunk;
$Safe{'scratch'}{'next'} = $start + $chunk;
$Safe{'scratch'}{'prev'} = $prev;
$Safe{'scratch'}{'not_shown'} = 1;
return '';
[/perl]
[search-region arg=" sf=section
se=001-
su=yes
fm=[scratch start]
ml=[scratch chunk]
dp=seastories2
tf=section
"]
[search-list]
<html removed>
[/search-list]
[/search-region]
<TABLE WIDTH="80%"><TR __HEADERBG__ TEXT="WHITE"><TD ALIGN=CENTER
VALIGN=CENTER>
<BR><FONT COLOR="__HEADERTEXT__" FACE="arial, helvetica">
[if scratch prev]
[page href=seastories2 arg="[scratch prev]:[scratch chunk]"]
<B>[L]Previous[/L]</B></A>
[/if]
[if type=explicit compare="[calc]
[value mv_search_match_count] > [scratch next]
[/calc]"]
[page href=seastories2 arg="[scratch next]:[scratch
chunk]"]<B>[L]Next[/L]</B></A>
[/if]
>****** message to minivend-users from Chris Rapier
><rapier@psc.edu> ******
>
>
>
>Victor Nolton wrote:
>
>> [loop search="sf=section/bs=yes/ml=25/su=yes/se=001-00/tf=section"]
>> This pulls up 99 items in the main section.
>> I'd like to avoid match limit and just tell it to print the items
>> between 001-0001 to 001-0025
>>
>> Suggestions? Is this even possible?
>
>Wait, isn't there an increment function? If you could increment a
>scratch variable on each pass through a loop you'd be able to do
>something like this.
>
>Alternatively, do it in embedded perl and avoid [loop] entirely.
>
>[perl]
>$ref->$Db{products}; #untested code but it should work
>for ($i; $i<=25; $i++) {
> if ($i < 10) { #i'm sure there is a better way to pad
> if (!$i) {$i = "0";} #this but its early and i'm tired
> $key = "001-00$i";
> } else {
> $key = "001-0$i";
> }
> $prodname = $ref->field($key, "product_name");
> #you can get as crazy as you like in building the
> #html that goes into scratch foo. You may need to
> #use stuff like $Config-{VendURL} to get at some
> #information
> $Scratch->{foo} .= "The product is $prodname.<br>";
>}
>[/perl]
>
>
>Everything that you generate, code wise, will be in [scratch foo]. Now,
>what I think would rock is if there is some way of interpreting whats in
>[scratch foo] so you could use minivend tags in the perl itself.
>
>In some similar code that I've used I used the following in $Scratch
> $Scratch->{'subcat_clickbar'} .= "<a
>href=\"$Config->{'VendURL'}/scan/sf=category,subcat,category2,subcat2
>/se=$rowname/se=$_/os=no/ml=5.html/tf=description,brand\"><img
>border=0 src =\"/windfallfoods/images/$_.gif\"></a>";
>
>Which allowed me to dynamically generate clickbars based on information
>in a catalog ooptions file.
>-
>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
Ven's News (Bookmark It) : http://www.vensnews.com
Ven (ven@pragakhan.com) _________________ http://ven.pragakhan.com __
AOL: WebmstrVen Praga Khan's Official Website ICQ: 8321393
http://www.pragakhan.com
-
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