[ic] [more-list] else tag

Mike Heins mike at perusion.com
Wed Dec 3 18:12:11 UTC 2008


Quoting Mathew Jones (mat at bibliopolis.com):
> Hi Everyone,
> 
> I would like to get some feedback on the following modification I made to the [more-list] tag. The 
> same result can probably be achieved a million ways, love to hear suggestions on how other people 
> would handle this.
> 
> Interpolate.pm
> --------------
> 
>         if($q->{matches} < $q->{mv_matchlimit}) {
>                  if($r =~ s:\[else\]($All)\[/else\]::i) {
>                                  return $1;
>                          } else {
>                                 return '';
>                         }
>          } else {
>                  $r =~ s:\[else\]($All)\[/else\]::i;
>          }
> 
> #       return '' unless $q->{matches} > $q->{mv_matchlimit}
> #               and $q->{mv_matchlimit} > 0;
> 
> 
> This will allow alternate text to be displayed if the match count is less than the match limit. For 
> example:
> 
> [more-list]
> 
> [msg arg.0="[matches]" arg.1="[match-count]"]Matches %s of %s found.[/msg]
> <br/>[more]<br/>
> 
> [else] [value mv_search_match_count] Results Found [/else]
> 
> [/more-list]
> 

The problem is the interplation level. It isn't checking that [/else] is the last
thing in the block. This would pirate an else from an [if ..] or anything else.
I think it would require a [then]....

If that problem is taken care of I could get behind it if the code removes
those insidious "cuddled else" statements. 8-)

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.328.4479  tollfree 800-949-1889 <mike at perusion.com>

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



More information about the interchange-users mailing list