[ic] Very Simple UserTag - Failed Safe Check

Brent Kelly brent at zeald.com
Thu Sep 16 18:07:14 EDT 2004


The problem is that you cannot use ITL from within your tag. What you need to 
do is pass that value as a parameter to your usertag.

Something like this:

--------------------------------------------------------------------------

UserTag lease-cost Order price
UserTag lease-cost addAttr
UserTag lease-cost Interpolate
UserTag lease-cost    Routine <<EOR

sub {

  my $price = shift;
  my $a36 = $price*33.67;
  my $a60 = $price*22.50;

 return <<EOF;

You could lease this item for only $a36 per month (36 months) or $a60 (60 
months) ex. VAT.<br>
<small><em>[ <a href="#">Click Here for Details</a> ]</em></small>
EOF

}
EOR

--------------------------------------------------------------------------

Then call your tag using: [lease-cost price="[value item-price]"] or something 
similar

Hope that helps.

-- 
Brent Kelly
Senior Developer
Zeald.com

E-Centre
PO Box 102-904
North Shore Mail Centre
Auckland
New Zealand

Ph: +64 9 415 7575
Fax: +64 9 443 9794
Mbl: (NZ) 021 434 102
Web: http://www.zeald.com


On Fri, 17 Sep 2004 08:14, Adrian P Wilkinson wrote:
> Hi again,
>
> Okay, after taking on the suggestions here (making it so it actually
> contains Perl; I didn't notice that the UserTag I was using as an example
> used a >>EOF in it where I saw the raw HTML) I've progressed to:
>
> ================================================================
> UserTag lease-cost      Routine <<EOR
> sub {
>
>   my $a36 = [value item-price]*33.67;
>   my $a60 = [value item-price]*22.50;
>
>  return <<EOF;
>
> You could lease this item for only $a36 per month (36 months) or $a60 (60
> months) ex. VAT.<br>
> <small><em>[ <a href="#">Click Here for Details</a> ]</em></small>
> EOF
>
> }
> EOR
> ================================================================
>
> Called from flypage.html:
>
> "[value item-price]" gives an Internal Server Error
> "[item-price]" fails the safe check.
>
> The calculation in a36 should take the item-price and multiply by 33.67.
> Although I can feel my way around in Perl, I've never had the need to
> perform calculations before, but doing "100*33.67" worked fine, so it's
> only when I try to get IC data in the calc that it got upset.
>
> Do I have to do do the "my = $Config(->variable)" soft of stuff to get the
> data out?  Hints welcome!
>
> Regards, Ade.
>
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users



More information about the interchange-users mailing list