Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Formatting Text Field Output

Quote Reply
Formatting Text Field Output
Heya,

I'd like to parse the input into a text field so that hitting return while entering the text will be passed on as a line break to the database to preserve the paragraph formatting that the user intended.

Any ideas on how this can be done easily?

Safe swoops
Sangiro
http://www.dropzone.com/
Post deleted by cdkrg In reply to
Quote Reply
Re: [sangiro] Formatting Text Field Output In reply to
Something like;

Code:
sub {
my $field = $_[0];
$field =~ s/\n/\<BR\>/gi;
return $field;
}

...called with something like;

<%global_name($FieldName)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [sangiro] Formatting Text Field Output In reply to
Hi-

I do something like this for the field Description with the global called Description_Formatted:

Description_Formatted

sub { my $tags = shift; my $description = $tags->{Description}; $description =~ s/\n/<BR>\n/g; return $description; }


Then on the template where I want the line breaks for the Description field retained I use the <%Description_Formatted%> tag instead of <%Description%>. You can change the global code to use another field name (replacing the field name Description with the other field name in the global code) to have that field output with line breaks.

--Frank