[ic] include tag problem

Ed LaFrance interchange-users@icdevgroup.org
Tue Jul 30 12:50:00 2002


At 12:45 PM 07/30/2002 +0100, you wrote:
>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?
>
>Any ideas, pointers, help, comments would be gratefully accepted by a
>newbie.

Because of parse-order issues, that will not work. If you want to 'include' 
page chunks which invlove looping sub-tags, you'll need to read them into a 
catalog variable. i.e.:

Variable MEDIAICONS <<EOV
[if-item-field media =~ /Paperback/ ]
<img alt="[item-field media]" valign=center
src="__THEME_IMG_DIR__icon_book.gif" border=0>
[/if-item-field]
EOV

You can put this directly in your catalog.cfg, or put it in a separate file 
and use an #include directive. Then reconfig your catalog. Place in on the 
page thusly:

__MEDIAICONS__

- Ed L.

===============================================================
Increase profits from your Interchange store...
http://www.newmediaems.com/cgi-bin/nm/software_fus.html
===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================