[ic] interchanging data between page and include

Mike Heins interchange-users@interchange.redhat.com
Thu Apr 4 18:14:01 2002


Quoting Kevin Walsh (kevin@cursor.biz):
> > 
> > hi all,
> > i'm probably just being thick but at the moment unable to figure the 
> > following:
> > if i have a flypage with the code
> > [fly-list code="data session arg"]
> > [item-code]
> > [/fly-list]
> > 
> > that works fine and then change it to
> > [fly-list code="data session arg"]
> > [item-code]
> > [include file="templates/mytemplate"]
> > [/fly-list]
> > 
> > with mytemplate being something along the lines of
> > [item-code]<br />
> > [item-field description]
> > 
> > why do the parameters not arrive/ are the tags left untouched?
> > or what would be even more interesting, how could i get the template to play 
> > with the values that the including file has got access to?
> > 
> > any pointers would be greatly appreciated as i am pretty lost on this one.
> > 
> First, I'll assume that the "data session arg" was a typo and
> you know about the missing "[" and "]". :-)
> 
> To answer your question, the [item-*] tags are "subtags" of the
> [fly-list] tag.  Once you get into your [include], you are
> inside a completely new tag and out of the reach of the subtag
> parser.
> 
> You could do one of two things:
> 
>     1) Move the [fly-list] tag into the included file.
> 
>     2) Don't use [include].  Read the file into a variable in
>        catalog.cfg and use __MYTEMPLATE__ on the page instead.
>        (I think that'll work).  In catalog.cfg:
> 
>            Variable MYTEMPLATE <templates/mytemplate

In my continuing quest for TIMTOWTDI:

    3)
        [fly-list interpolate=1 code="[data session arg]"]
        [file templates/mytemplate]
        [/fly-list]

Since [file ...] doesn't reparse, the tags will be put in for dealing
with [fly-list], then reparsed on its output.

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Fast, reliable, cheap.  Pick two and we'll talk.  -- unknown