[Templates] substr vmethod

Cees Hek ceeshek@gmail.com
Wed, 9 Aug 2006 11:37:13 -0400


On 8/9/06, Jonathan Mangin <jon.mangin@comcast.net> wrote:
> Hi all,
>
> I thought I'd seen someone mention a substr vmethod
> on this list.  I can't find anything about substrings
> in the manual.
>
> I need to display the first 34 chars. of a template
> variable.  Is there some way to do that?

Look for the 'truncate' filter in Template::Manual::Filters.  It will
add '...' to the end by default, but you can control that by passing
in a second parameter.

[% myvar | truncate(34, '') %]

Cheers,

Cees