m118 Posted March 12, 2012 Share Posted March 12, 2012 hello I need to fix code display problem. The code below cause the disorder problem. When I delete the part of it , the code display in the right way. I do not really understand it . The template try to use bx_textarea to display code,so I find the function in it. Finally , I found this function cause the disorder code problem. <?php echo bx_highlight(bx_textarea($view_query_result['jdescription']), $kwd_search);?> if ($char == "<") { $skip=1; } elseif ($char == ">") { $skip=0; } elseif ($char == " ") { $wrap=0; } if ($skip==0) { $wrap=$wrap+1; } function bx_wordwrap($a_str, $a_break_length=75) { $length = strlen($a_str); for ($i=0; $i<=$length; $i=$i+1) { $char = substr($a_str, $i, 1); if ($char == "<") { $skip=1; } elseif ($char == ">") { $skip=0; } elseif ($char == " ") { $wrap=0; } if ($skip==0) { $wrap=$wrap+1; } $res_str = $res_str . $char; if ($wrap>$a_break_length) { $res_str = $res_str." "; $wrap=0; } } return $res_str; } function bx_textarea($text) { return nl2br(preg_replace('/\t/',' ',bx_wordwrap($text, 75))); }//end function bx_textarea($text) Link to comment https://forums.phpfreaks.com/topic/258770-how-to-fix-the-code-display-problem/ Share on other sites More sharing options...
Psycho Posted March 12, 2012 Share Posted March 12, 2012 Place the code between [ code ] [ /code ] tags (without the additional spaces) so it will render correctly in the forum. Then explain what you mean by displaying correctly or not. We have no clue what the output should look like. Link to comment https://forums.phpfreaks.com/topic/258770-how-to-fix-the-code-display-problem/#findComment-1326551 Share on other sites More sharing options...
m118 Posted March 12, 2012 Author Share Posted March 12, 2012 sorry , I just fix it. Link to comment https://forums.phpfreaks.com/topic/258770-how-to-fix-the-code-display-problem/#findComment-1326553 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.