[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: use of the [tag log] tag
On Thu, 24 Jun 1999, .cory.trese. wrote:
> ****** message to minivend-users from ".cory.trese." <digital@arcane.specialty-books.com> ******
>
> List
>
> I'm trying to use the [tag log] in the following manner :
>
> ----
> [if data validcoupons::valid::[value student_id] eq 1]
> [tag log logs/used.txt]
> [value student_id]
> [/tag]
> logged.
> [else]
> ahh, no coupon!
> [/else]
> [/if]
> ----
Hmm, I usually use a little bit of Perl:
[if explicit]
[condition]
my $flag = '[data base=validcoupons field=valid
key=[value student_id]]';
if($flag) {
return 1;
}
else {
return 0;
}
[/condition]
[then]
...
[/then]
[/if]
I created a UserTag that lets me log nearly anything on a page:
UserTag log-value AddAttr
UserTag log-value Routine <<EOR
sub {
my ($opt) = @_;
my $output;
$output = $opt->{message};
::logGlobal($output);
}
EOR
Within the pages, I use this like this:
[log-value message='some stuff']
for instance, you could use this to see what value you are getting back
from the database:
[log-value messages='[data base=validcoupons field=valid
key=[value student_id]]']
In the error.log file, I would see the value. This proved invaluable when
I was trying to make sure I was getting what I expected.
I hope this helps.
You might want to fiddle with log-value a bit. I originally used it as a
testbed for how to pass variables to UserTags. It could be simplified a
bit. Seems to work though :-)
Best,
Kyle