[ic] Custom looping tab -- [prefix-change] doesn't work

Barry D. Hassler interchange-users@icdevgroup.org
Mon Sep 9 03:01:05 2002


Hi,

I've been working on a custom looping tag, which for the most part =
works. However, I haven't been able to get the [prefix-change] tag =
portion to work in order to create groupings of the data.

Following I have my test custom tag, the test HTML file, and the output =
I get. If anyone can point out what I'm going wrong here, I'd greatly =
appreciate it!



=3D=3D=3D=3D=3DTAG=3D=3D=3D=3D=3D=3D
UserTag abbey Interpolate 1
UserTag abbey HasEndTag
UserTag abbey Routine <<EOF
sub {
#line 6 "abbey.tag"
        my ($text) =3D @_;

        my $str;
        my ($i, $end, $count, $opt_select);
        my ($mv_field_hash, $mv_results, $opt);

        $i =3D 0;
        $end =3D 3;
        $count =3D 1;
        $opt_select=3D'';

        $mv_field_hash =3D {
                'code' =3D> 0,
                'field1' =3D> 1,
                'description' =3D> 2,
                'data' =3D> 3 };
        $mv_results =3D [
                [ 1, 'a', 'alpha', 'one' ],
                [ 2, 'b', 'beta', 'two' ],
                [ 3, 'b', 'beta', 'three' ],
                [ 4, 'c', 'gamma', 'four' ],
                [ 5, 'c', 'gamma', 'five' ],
                [ 6, 'd', 'delta', 'six' ],
                [ 7, 'd', 'delta', 'seven' ],
                ];

        $opt->{object}->{mv_results} =3D $mv_results;
        $opt->{object}->{list} =3D 1;
        $opt->{object}->{more} =3D 1;
        $opt->{object}->{matches} =3D 7;
        $opt->{object}->{type} =3D 'list';
        $opt->{object}->{mv_field_hash} =3D $mv_field_hash;
        $opt->{object}->{prefix} =3D 'abbey';

        return Vend::Interpolate::region($opt, $text);
}
EOF

=3D=3D=3D=3D=3DTEST=3D=3D=3D=3D=3D=3D
[abbey]

        [on_match]Matched<br>[/on_match]
        [no_match]No Matches<br>[/no_match]

        <table>
                <tr>
                <td>Code</td>
                <td>field1</td>
                <td>description</td>
                <td>data</td>
                </tr>
        [list]
                [abbey-change one]
                        [condition][abbey-param field1][/condition]
                        <tr>
                        <td colspan=3D4>
                                [abbey-param description]
                        </td>
                        </tr>
                [/abbey-change]
                <tr>
                <td>[abbey-code]</td>
                <td>[abbey-param field1]</td>
                <td>[abbey-param description]</td>
                <td>[abbey-param data]</td>
                </tr>
        [/list]

        </table>

        [more_list]
                [more]
        [/more_list]
[/abbey]

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DOUTPUT=3D=3D=3D=3D
Matched
Code field1 description data=20
[abbey-change one] [condition]a[/condition]  alpha =20
[/abbey-change]  1 a alpha one=20
[abbey-change one] [condition]b[/condition]  beta =20
[/abbey-change]  2 b beta two=20
[abbey-change one] [condition]b[/condition]  beta =20
[/abbey-change]  3 b beta three=20
[abbey-change one] [condition]c[/condition]  gamma =20
[/abbey-change]  4 c gamma four=20
[abbey-change one] [condition]c[/condition]  gamma =20
[/abbey-change]  5 c gamma five=20
[abbey-change one] [condition]d[/condition]  delta =20
[/abbey-change]  6 d delta six=20
[abbey-change one] [condition]d[/condition]  delta =20
[/abbey-change]  7 d delta seven=20