[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ic] ifs with scratch variables



> -----Original Message-----
> From: suppressed
[mailto:interchange-users-
> suppressed On Behalf Of Bob Puff
> Sent: Sunday, November 19, 2006 2:53 PM
> To: suppressed
> Subject: [ic] ifs with scratch variables
> 
> Hi Group,
> 
> I was recently messing around with the shipmode page from a recent
> install.
> Using a IC 5.2 engine, I tried:
> 
> [tmp bobshp][shipping mode="[loop-code]"][/tmp]
> 
> ..within the listing of shipping modes.  It does indeed "take", as I
can
> say
> something like:
> 
> Cost: [scratch bobshp]
> 
> and it prints out nicely.  However, I can't seem to get this to work:
> 
> [if scratch bobshp eq "$0.01"] ...

That doesn't work as is on 5.2.0.
Without the quotes, though, it apparently works fine.  Seems that last
part is taken as what to compare -- quotes and all.

Seems to work either way on 5.3.1.


> I've tried a few different things, like:
> [if type=explicit compare='[scratch bobshp] eq "$0.01"']

That won't work.  I see two problems:
- Double quotes around your price.  $0 is special to perl; on most
systems, it's the name of the running program.  And that's assuming the
Safe module would even let that info through, which it appears not to.
Double quotes tell perl to interpolate variables in the string, so the
string you're actually comparing likely ends up as ".01".
- No quotes around your scratch tag.  In perl, $0.01 ends up parsed like
($0 . 1), which returns "1" on my machines.


If you want to try the explicit way, try this:
[if type=explicit compare="'[scratch bobshp]' eq '$0.01'"]
Or, maybe better if you really want to do the explicit thing:
[if type=explicit compare="$Scratch->{bobshp} eq '$0.01'"]

Or, if you were just trying to use named parameters for your [if...]:
[if type=scratch term=bobshp op=eq compare="$0.01"]

> ...but can't seem to get it to work.  And this is when it is
displaying
> "$0.01" in the simple printing of [scratch bobshp].  What am I doing
> wrong?

Might want to temporarily put some kind of delimiters around the output
of the shipping rate, so you can see whether there's any space that
shouldn't be there.


_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.