[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: Re:Re: [mv] More list into two variables? Next & Previous
****** message to minivend-users from "Bill Randle" <billr@exgate.tek.com> ******
Geoff,
As the original poster, I guess I'll respond....
On Oct 5, 9:54am, minivend@hq.com.au wrote:
} Subject: Re:Re: [mv] More list into two variables? Next & Previous
} ****** message to minivend-users from minivend@hq.com.au ******
}
} Thanks Mike!
}
} I pasted the [perl global=1] you wrote into the results page but it didn't
} seem to work.. Should I be placing it inside other tags? How do I call the
} variables? [scratch?]
Did you check the error log for any messages?
When I tested it, I placed the [perl global=1] block directly after the
[search-region] [/search-region] block. Yes, use [scratch prev] and
[scratch next] to get the previous and next URLs.
Also note, if you have "global=1" in the [perl] tag you need to use
AllowGlobal catalog_name
is your minivend.cfg file. I'm not sure if you need the "global=1" or
not. Try removing the global=1 part. If you see errors in your error.log
file complaining about not being able to access some variables, put it
back in and add the AllowGlobal directive in minivend.cfg.
} I also tried to make it into a global sub in minivend.cfg and call it with
} [perl arg="sub" interpolate=1 global=1]nextvar[/per]
}
} ?How should I best/easiest implement it? (If I could implement it only in
} only a [perl] block on the page it would be good.
My natural inclination would be to make it into a UserTag. Perhaps
something like (untested!):
UserTag more_url Order type
UserTag more_url PosNumber 1
UserTag more_url HasEndTag 1
UserTag more_url Interpolate 1
UserTag more_url Routine <<EOR
sub {
my ($arg, $anchor) = @_;
my $q = $Vend::SearchObject{''};
my $session = $q->{mv_cache_key};
my $chunk = $q->{mv_matchlimit};
my $total = $q->{matches};
my $page = $q->{mv_search_page} || $Global::Variable->{MV_PAGE};
my $form_arg = "mv_nextpage=$page";
my $urltag = '';
if ($arg =~ /prev/) {
# previous url
my $first = $q->{mv_first_match} || 0;
if($first) {
$first = 0 if $first < 0;
$arg = $session;
$arg .= ':';
$arg .= $first - $chunk;
$arg .= ':';
$arg .= $first - 1;
$arg .= ":$chunk";
}
}
else {
# next url
if ($next) {
$last = $next + $chunk - 1;
$last = $last > ($total - 1) ? $total - 1 : $last;
$arg = "$session:$next:$last:$chunk";
}
}
$urltag .= '<A HREF="';
my $form_arg = "mv_nextpage=$page";
$urltag .= tag_area( "scan/MM=$arg", '', { form => $form_arg });
$urltag .= '">';
$urltag .= $anchor;
$urltag .= '</A> ';
return $urltag;
<<EOR
You would then use this in a page like:
[more-url prev]Previous Page[/more-url] [more-url next]Next Page[/more-url]
or:
[set prev_anchor]Click here to select the previous page[/set]
[set next_anchor]Only click here if you want ot see more![/set]
[more-url prev][scratch prev_anchor][/more-url]
[more-url next][scratch next_anchor][/more-url]
As I said, I haven't tested this, but I don't see why it wouldn't work.
-Bill
-
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