[ic] include tag problem

Mike Heins interchange-users@icdevgroup.org
Tue Jul 30 12:44:01 2002


Quoting Andy Mayer (me@andymayer.com):
> Hi guys,
> 
> I have just started using the excellent Interchange software, and am
> tailoring the Foundaton Demo (don't switch off!) to my requirements...
> 
> My problem is that I have some common code that I want to use in
> flypage.html and results.html, but when I put the code into a separate
> include file, Interchange doesn't parse the tags in the code, it just
> displays it. I am using the following code to do the include:
> 
> [include templates/__THEME__/mediaicons]
> 
> and the contents of included file mediaicons is:
> 
> [if-item-field media =~ /Paperback/ ]
> <img alt="[item-field media]" valign=center
> src="__THEME_IMG_DIR__icon_book.gif" border=0>
> [/if-item-field]
> 
> The above code works perfectly when pasted into results.html and
> flypage.html, but when I use the include tag then the browser displays
> the code without parsing any of the IC tags.
> 
> Does this ring any bells?

Interchange tags are interpretive, not compiled. The code must
be there when the surrounding tag starts. That is why we use
__VARIABLE__ to do that.

[include ...] happens at runtime, and since the [item-field ...]
tags are not there when the surrounding tags are substituted, they
get ignored.

You could surround it with:

[loop list="[item-code]" prefix=item]
[include file]
[/loop]

And it would work. Better would be to use some other page-construction
strategy.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Experience is what allows you to recognize a mistake the second
time you make it. -- unknown