Jump to content

how to fix the code display problem


m118

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.