Interpolation in [control-set] (see code) (was Re: [ic] foundation store mv_searchspec problem)

Daniel Davenport ddavenport at
Tue Dec 28 14:32:31 EST 2004

>>> mailinglists at 12/28/04 12:34PM >>>
> Hi list:
> I am trying to modify the foundation store. When using the 
> [value-extended name=mv_searchspec] on the results.html page the 
> selected search string will be show on the page. But when using 
> [value-extended name=mv_searchspec] as a parameter to a component I
> just get the plain "[value-extended name=mv_searchspec]" text.
> What can be the problem here?
> Thanks in advance,
> Wojtek
The [control-set] tag, which is used to set the parameters for
components, doesn't do interpolation well at all.  Since there's already
a [component] tag, interpolate=1 is a really bad thing to do if you're
setting components' controls.  You can, if you really have to,  use a
bit of trickery....
[loop list="[value-extended mv_searchspec]" prefix="srch"]
[control reset=1]
....other control-sets
....other control sets?...
[control reset=1]
Parse order makes the [srch-code] tag expand first, so all works as
you can accomplish this in the content editor by putting the [loop...]
tag in the preamble, and the [/loop] at the beginning of the content. 
It's ugly, but it should work.  Just make sure no control name has a
space in it.  :)
you could also replace the control-set tag with this....
UserTag control-set         Order        index
UserTag control-set         addAttr
UserTag control-set         hasEndTag
UserTag control-set         PosNumber    1
UserTag control-set         Routine      <<EOR
sub {
    my ($index, $opt, $body) = @_;
    $index = ($::Scratch->{control_index} || 0) unless defined $index;
    while($body =~ m{\[([-\w]+)(( \w+)*)\](.*)\[/\1\]}sg) {
        my $name = lc $1;
        my $val = $4;
        my $special = $2;
        $val = Vend::Interpolate::interpolate_html($val) if $special =~
        $name =~ s/-/_/g;
        $::Control->[$index]{$name} = $val;
enchantments still won't work in the content editor, but if you edit a
page by hand you can do interpolation like this....
 [searchspec interpolate][value-extended
if someone can fix up the content editor to detect and set
interpolation, i'd be their best friend.
two notes:
1.  The new tag makes spaces in control names illegal.  I'm pretty sure
they were anyway, but just in are warned.
2.  Everything after the first space in the control start tags is
treated as a lump of characters and scanned for keywords (and right now,
the only keyword is "interpolate").  so interpolate, interpolate=1, and
interpolate=0 (!!) will all turn on interpolation.  This can be fixed,
if doing so would make fixing the content editor less of a pain.

More information about the interchange-users mailing list