Gossamer Forum
Home : Products : Gossamer Links : Discussions :

new line in DESCRIPTION

Quote Reply
new line in DESCRIPTION
HI,
When the user input the DESCRIPTION they type new line, but on result, the descriptions display in one line.
Haw I can display descritoins like the user type ti?
Quote Reply
Re: [Troja] new line in DESCRIPTION In reply to
Hi-

You can create a new Global by going to the Build in the admin, and then selecting the Template Globals link. Then you would add a new one called:

Description_Formatted =>

And Add this code:


Code:
sub {
my $tags = shift;
my $description= $tags->{Description};
$description=~ s/\n/<BR>\n/g;
$description= GT::CGI::html_escape($description);
return $description;
}

and then use <%Description_Formatted%> on your template instead of <%Description%>, and then it will keep the line breaks that people put in when they entered their information.

-FrankM

Last edited by:

FrankM: Mar 22, 2002, 2:47 PM
Quote Reply
Re: [FrankM] new line in DESCRIPTION In reply to
Thanks,

I whill use it with html_UNescape.
Quote Reply
Re: [FrankM] new line in DESCRIPTION In reply to
hey Man. I tried using that string you posted and it doesn't really work. I created the global and edited <%Description%> global. For some reason the script reads the <br> as text and not a line break. Can someone please help me out? I need line breaks in my descriptions.
Quote Reply
Re: [4x4search] new line in DESCRIPTION In reply to
This works for me:

Global Name: Description_Formatted

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

There is probably a better way to do this....

--Frank