[ic] improving awkward IF syntax

Bob Ramstad interchange-users@interchange.redhat.com
Thu Dec 20 15:37:25 2001


Second question.  

(Again, I'm a digester, so if you send a response to the list and to
me directly, I'll be able to get this fixed faster.  Thanks in advance
for CCing me directly.  Yow.)

One of my goals is to make it so that all the content lives in the
database and is being served from flypage.html.  That's the way we've
got it architected on another system, and we'd like to keep it that
way.

I've added products::type and products::orderable as columns to the
products database.  type can be PAGE, ITEM or NIL.  orderable can be
YES or NO.  Using combinations of these settings, I can determine
exactly how to display the page.

This setup has been working fairly well, but one thing that is
bothering me is that I have to use some rather awkward constructions
in flypage.html for testing these values, like this:

[if explicit][condition]return [item-field type] eq 'ITEM';[/condition]
<<code>>
[/if]

For whatever reason, all the more obvious bits of simpler syntax do
not work.  I end up in the ELSE clause when I'm not supposed to, or
the code is skipped over... indicating that the test didn't match.

I've tried a variety of constructions, with and without quoting the
argument, e.g.

[if-item-field type eq 'ITEM']

doesn't work.

I'm concerned that this convoluted syntax may lead to performance
issues down the road.  So, a couple of (obvious) questions:

1) Is there a better and simpler ITL syntax which will work?

2) If not, is there a simplification or modification of my database
   structure which will allow better and simpler ITL syntax?

3) Finally, I see references in the documentation to the fact that IF
   is slow, and complicated tests should be done in Perl for
   performance reasons.  Can someone give me an example of how to do
   the test above in Perl?

Thanks in advance for your help!

-- Bob