[ic] Two newbie questions

Kevin Walsh interchange-users@icdevgroup.org
Fri Nov 15 08:10:01 2002


Michael Bacarella [mbac@netgraft.com] wrote:
> 
> I'm still totally unfamilar with the ITL and it seems
> as if just a few seconds of time from someone experienced
> will save me hours of head scratching.
> 
> What's the idiom for only dealing with a single datum
> from a file? That is, I am currently doing:
> 
>     [loop search="sf=id/se=[cgi mv_arg]/fi=products"]
>         Details page for [loop-data products name]<br>
>     [/loop]
> 
> which is overkill, because I know only one product will
> match this and I want to display it more as a headline
> instead of rendering a sequence of data (I'm aware of
> flypage.html, that's not exactly what I'm trying to do).
>
You need the [data] tag, so your above loop would convert to:

    [data table="products" column="name" key="[cgi mv_arg]"]

Well, it would convert to that if "id" was your products table's
primary key.  I assume that it is, although most people call it
"sku" in commerce-related applications.

> 
>     [page foo [cgi mv_arg]]click here</a>
> 
> renders a hyperlink to foo that doesn't quite work as I expected (the
> highlighted link actually reads  "]click here").  What am
> I doing wrong?
> 
You've made a common mistake with your tag arguments.  The [page] tag
would be passed three parameters: "foo", "[cgi" and "mv_arg]".  You'll
need to use the "named parameter" syntax instead:

    [page href="foo" arg="[cgi mv_arg]"]Click here</a>

I prefer the [area] tag myself, which is similar:

    <a href="[area href='foo' arg='[cgi mv_arg]']">Click here</a>

See the following sections in the Interchange Tags Reference:  "[page]",
"[area]" and "Named vs. Positional Parameters."

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/