> I have thousands of Lines like this following Code:
>
-------8<----------
$out->{menue} .= sprintf "<br/><a href=\"%s\">%s%s</a>",
              "${linkbase}&#38;msg_pp=".( (($out->{first_msg_nr}-1)<10)
? > ($out->{first_msg_nr}-1-1) :
"10" )."&#38;ron=mend-".($out->{first_msg_nr}-1)."&#38;msgno_begin=".(
( ($out->{first_msg_nr}-1-10)>1 ) ? ($out->{first_msg_nr}-1-10) : 1),
                ( ($show_images) ? "<img
src=\"${wapmail}img/icon_vorige_seite.wbmp\" localsrc=\"leftri1\"
alt=\"\"/> " : "" ),
                '<!--xb -->Zur�ck<!--xe -->'
                if ($out->{first_msg_nr}>1);
-------8<----------

With PRE_CHOMP and POST_CHOMP on, you could just do this:

[% IF (first_msg_nr - 1) < 10 %]
  [% msg_pp = first_msg_nr - 2 %]
[% ELSE %]
  [% msg_pp = 10 %]
[% END %]

[% IF (first_msg_nr - 11 > 1) %]
  [% msgno_begin = first_msg_nr - 11 %]
[% ELSE %]
  [% msgno_begin = 1 %]
[% END %]

<br/><a href="[% linkbase %]&#38;msg_pp=[% msg_pp %]&#38;msgno_begin=[%
msgno_begin %]">
[% IF show_images %]
<img src="[% wapmail %]img/icon_vorige_seite.wbmp" localsrc="leftri1"
alt=""/>
[% END %]
<!--xb -->Zur�ck<!--xe -->

No new syntax is needed for this.  It's still a pain to translate, but
that's because the original perl sprintf perl code is kind of nasty, not
because of a TT short-coming.  This would be even tidier if you put the
msg_pp and msgno_begin calculation in your perl code rather than in the
display template.

- Perrin



Reply via email to