string_nl2br doesn't wrap anything ...

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
r3z3
Posts: 3
Joined: 23 Jun 2012, 13:36

string_nl2br doesn't wrap anything ...

Post by r3z3 »

Hi,
I don't understand how the function "string_nl2br" works :cry: .
I want to split long words in the "description" column. I modified the columns_api.php like that :

function print_column_description( BugData $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
$t_description = string_display_links( $p_bug->description );

echo '<td class="column-description">' . string_nl2br($t_description) . '</td>';

... but it just duplicates blank lines in the column ! the wrap doesn't work
I specified a $p_wrap = 10 and the "wrap_in_preformatted_text" is ON in the "config_defaults_inc.php" file.

What I'm missing ?? :oops:
r3z3
Posts: 3
Joined: 23 Jun 2012, 13:36

Re: string_nl2br doesn't wrap anything ...

Post by r3z3 »

"solved" adding this new function to string_api.php :


function myWordWrap ($string, $length=30, $wrap=' ', $from='left') {
if ($from=='left') $txt=wordwrap($string, $length, $wrap, true);
if ($from=='right') {
$m = strlen($string)%$length;
if ($m < strlen($string))
$txt = substr($string,0,$m).$wrap.wordwrap(substr($string,$m),$length, $wrap, true);
else
$txt = $string;
}

return $txt;
}
Post Reply