Akopia Akopia Services

[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 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


Search for: Match: Format: Sort by: