[ic] Database Handle and Global Subs

Mark Johnson interchange-users@lists.akopia.com
Wed Jun 13 16:39:01 2001


Sheamus Nulty wrote:
> 
> Mark,
> 
> My problem is with the if statement because for some reason its just
> printing what ever I put after it. If I put the following on a page and run
> it
> 
> [pdfcreate foo="[cgi orders]"]
> 
> my pdfs are generated. However if I do the following
> 
> [set print]1[/set]
> [if scratch print]
> [pdfcreate foo="[cgi orders]"]
> [/if]
> 
> what gets returned in the browser is
> 
> [pdfcreate foo="[cgi orders]"] as text and no pdfs are generated.
> 
> Sheamus
> 

I'm with you. I can't see anything wrong with that. Perhaps you could
post the block of code that all relates to this so I can see if
something around the code is causing problems. Generally speaking, the
only reason you should see [pdfcreate...] as text is if that usertag
isn't defined. But, if it's interpolating outside the if block, then
clearly it's defined.

If you get desperate, you can always recode your usertag to handle the
if conditions internally. Something like:

[set print]1[/set]
[pdfcreate foo="[cgi orders]" scratchif=print]

Then, in pdfcreate before any other code is executed (assuming you put
the second param into the same-named scalar):

 return undef unless $Scratch->{ $scratchif };

I only say this because, frankly, I have no clue why an if block would
keep IC tags from interpolating.

-- 
Mark Johnson
Senior Systems Architect - Professional Services
Red Hat, Inc.
E-Business Solutions
markj@redhat.com
703-456-2912