Gossamer Forum
Home : Products : Others : Gossamer Community :

line break in textfield

Quote Reply
line break in textfield
Hm, I have a field in my gcommunity database, just to store some information about the user.
But in the user profile the field shows no line breaks.

it shows
line 1 line 2 line 3

but it should show
line 1
line 2
line 3

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] line break in textfield In reply to
Is it set as a TEXTAREA field, or just TEXT?

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: [Matthias70] line break in textfield In reply to
Ah sorry, I know what you mean now

You just need to run it through a simple global to convert \n to <Br />

convert_nl_to_br
Code:
sub {
my $tmp = $_[0];
$tmp =~ s/\n/<br>/sg;
return \$tmp;
}

..call with:

<%convert_nl_to_br($prof_Field)%>

Should do the trick

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: [Andy] line break in textfield In reply to
Andy wrote:
Is it set as a TEXTAREA field, or just TEXT?

Hi Andy,
thanks for the global.

I'm trying to set up a field, where I can notice some information about the user.
What type of field would you recommend?
VARCHAR or TEXT?

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] line break in textfield In reply to
If you expect more than 255 charachters, you will need a TEXT

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: [Andy] line break in textfield In reply to
Hi Andy,
the global shows me this error
Code:
Error: Variable 'convert_nl_to_br' is not a code reference

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] line break in textfield In reply to
Do you have any extra "spaces before or after the sub { } bits?

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: [Andy] line break in textfield In reply to
Andy wrote:
Do you have any extra "spaces before or after the sub { } bits?

No there are no spaces before or after!
I'm trying to call the global in
community.cgi?do=user_profile

Perhaps that's the problem??

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] line break in textfield In reply to
Mmm, and how about any extra spaces in the Globals name? (best to check globals.txt direct, to verify this)

The global is fine, so not sure why its giving that error!

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: [Andy] line break in textfield In reply to
Upps, there was an extra space at the end of the global name.
Never had this before.
Could see it only in globals.txt
Very strange...
Thanks, now its working fine!

Matthias
gpaed.de

Last edited by:

Matthias70: Nov 18, 2010, 11:48 AM
Quote Reply
Re: [Matthias70] line break in textfield In reply to
Np, thought it must have been something like that Wink

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!