Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: how to chomp or trim extra characters like \n ,white spaces in text area using template toolkit

by Fang (Pilgrim)
on Nov 24, 2005 at 09:15 UTC ( [id://511369]=note: print w/replies, xml ) Need Help??


in reply to how to chomp or trim extra characters like \n ,white spaces in text area using template toolkit

You can either use pre/post-chomping in your directives, as in:

[% FOREACH option = element.value %] [%- option -%] [% END %] # this is equivalent to writing those three directives on a single lin +e: # [% FOREACH option = element.value %][% option %][% END %]

or you can use global options when you create your new Template object if you want such a behaviour applied everywhere:

my $template = Template->new( { PRE_CHOMP => 1, POST_CHOMP => 1, } );

You can read more about those options in the Template::Manual::Config doc.

  • Comment on Re: how to chomp or trim extra characters like \n ,white spaces in text area using template toolkit
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://511369]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-24 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found