Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

Perl question, please help

Quote Reply
Perl question, please help
I can't get new lines and paragraph breaks out of an incoming variable. I have tried

$var =~ s/\n\n//g;
$var =~ s/\r\r//g;
$var =~ s/\n\n+//g;

I'd be thankful for any help.

~Margaret

"There is nothing so unequal as the equal treatment of unequals." ~ Thomas Jefferson
Quote Reply
Re: Perl question, please help In reply to
Deja vu!

This was recently discussed in the Links 2.0 Customization forum, like yesterday.

What you need to do is use:

Code:

$in{'FieldName'} =~ s/\n\n/<p>/g;
$in{'FieldName'} =~ s/\n/
/g;


in the sub site_html_add_form and sub site_html_add_success in the site_html_templates.pl file. Although the better thing to do is format the line breaks and paragraph breaks in the sub site_html_link routine in the site_html_templates.pl file with the following codes:

Code:

$rec{'FieldName'} =~ s/\n\n/<p>/g;
$rec{'FieldName'} =~ s/\n/< br >/g;


Also, this is more of a customization or code hack question and should be posted in the Links 2.0 Customization Forum after you search it thoroughly.

Regards,

Eliot Lee