> > 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?
>
> Hackish, but should work:
>
> [% var.chunk(34).0 %]
It is not too effective, I guess. The 'substr' vmethod works well:
[% str.substr(0, 34) %]
There also is nice 'trucate' filter, it trucates the string and appends it
with '...':
[% str | truncate( 34 ) %]
To avoid '...' appending, use:
[% str | truncate( 34, '' ) %]
--
Sergey Martynoff
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|