
ssmythe
New User
Oct 31, 2011, 9:40 AM
Post #1 of 2
(10109 views)
|
Line Breaks/Returns
|
Can't Post
|
|
I'm have a problem with preserving line breaks. When the user fills in their company description on the form line breaks appear but when the data comes from the database the line breaks disappear! Can anyone help? print $thebest->{cgi}->header; my @company; my $ctitle = "Company Description"; my $keywords = "Company Keywords"; my $cdescription = "Company Description"; my $companies = $thebest->database("getCompany", { "company_id" => $cid, geolocation => $geolocation }); use Data::Dumper; foreach (@$companies) { my $item = $_; if($item) { $item->{hash} = $thebest->auth("md5string", { "string" => "$item->{id}" }); if($item->{reviews_total} == 0) { $item->{stars} = 0; } else { $item->{stars} = int($item->{reviews_total} / ($item->{reviews} - 1)); } $ctitle = $item->{name}.": ".$item->{keywords}; $keywords = $item->{keywords}; my (@desc) = split(//, $item->{description}); my $adesc; my $rowc = 0; my $count = 0; my $total = @desc; while($count < $total) { if($rowc == 60) { $adesc .= @desc[$count]; $rowc = 0; } else { $adesc .= @desc[$count]; } $rowc++; $count++; } $item->{description} = $adesc; $cdescription = $item->{sdescription} ; push(@company, $item); }
|