Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] [if explicit][condition] troubles



******    message to minivend-users from Jonathan <jrs@abhost.net>     ******

I've managed to get minivend to do what I want it to do with the userdb
but for some reason the checkout page is being displayed instead of the
mv_nextpage.  If anyone can show me what I can do so that the
mv_nextpage gets displayed instead of the ord/checkout I'd be thankful.

(ideally what I'd like to do is have the mv_nextpage set to the current
page that the user is viewing... but for now I'll be happy with
mv_nextpage being the root of my minivend site.)

I haven't figured out why any of the test examples below don't work but
I've been able to do this instead:

[set name="logged_in" interpolate=1][perl interpolate=1]
  my $username = '[value mv_username]';
  if ($username eq 'guest' || $username eq '') { return 0; }
  else { return 1; }
[/perl][/set]

[if scratch logged_in]
[include pages/special/logout.html]
[else]
[include pages/special/login.html]
[/else]
[/if]

key parts of the login.html look like:

<form action="[process-target]" method="post">
<input type="hidden" name="mv_click" value="Login">
<input type="hidden" name="mv_doit" value="return">
<input type="hidden" name="mv_nextpage" value="/">
<input type="text" name="mv_username" value="">
<input type="password" name="mv_password" value="">
<input type="submit" value="Log in"></font></td>
</form>

key parts of the logout.html look like:

<form action="[process-target]" method="post">
<input type="hidden" name="mv_click" value="Login">
<input type="hidden" name="mv_doit"  value="return">
<input type="hidden" name="mv_nextpage" value="/">
<input type="hidden" name="mv_username" value="guest">
<input type="hidden" name="mv_password" value="no_password">
<input type="hidden" name="mv_verify" value="no_password">
<input type="hidden" name="mv_cookie_password" value="1">
</form>

any help would be welcome.

thanks a lot.

-- Jonathan


> ******    message to minivend-users from "abhost.net" <mvend@cedar.abhost.net>     ******
> 
> Hi. I'm having some trouble getting 'if explicit' to do what I think it
> should do. If someone would help me out I'd be very grateful.
> 
> I've distilled my troubles down to a few test examples which hopefully
> illustrate what I'm trying to do. Each of these examples give the wrong
> result.
> 
> First, an if elsif else based on the value of a scratch varable...
> (I don't suppose that I can do 'condition interpolate=1' can I?)
> 
> <h3> example one </h3>
> 
> [set test]5[/set]test == '[scratch test]'
> [if explicit][condition]
>   my $test = '[scratch test]';
>   if ($test < 2) { return 0; }
>   elsif ($test < 4) { return 0; }
>   else { return 1; }
> [/condition]
> correct
> [else]
> incorrect
> [/else]
> [/if]
> 
> Next, why is it that the start of line anchor '^' or the end of line
> anchor '$' mess up the regex matching?
> 
> <h3> example two </h3>
> 
> [set test]test[/set]test == '[scratch test]'
> [if explicit][condition]
>   my $username = '[scratch test]';
>   if ($username =~ /^test$/) { return 1; }
>   return 0;
> [/condition]
> correct
> [else]
> incorrect
> [/else]
> [/if]
> 
> Finally, I might as well show this; it's what I really want to accomplish
> anyway.  The first two examples I only came up with during my attempts to
> get this to work.
> 
> the problem with this one is that the condition is always true... I
> imagine that if I could get example one and example two working this one
> would work as well...
> (I have a good imagination :)
> 
> <h3> what <i>really</i> I want to do </h3>
> 
> username == '[value mv_username]'
> [if explicit][condition]
>   my $username = '[value mv_username]';
>   if ($username =~ /^guest$/ || $username =~ /^$/) { return 0; }
>   else { return 1; }
> [/condition]
> $username =~ /^guest$/ || $username =~ /^$/
> [else]
> !($username =~ /^guest$/ || $username =~ /^$/)
> [/else]
> [/if]
> 
> Again, if there's anything that anyone can say to set me straight, I'll
> really appreciate it.  I'm using mv 3.14-5 with perl 5.005_03 on linux.
-
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: