php - Wordwrap will issue link src and img src -


<?=$postcontent = wordwrap($qry_post['content'], 67, "<br />", true);?> 

if content has long link in it, or big code, halt @ part ,
it, result in html entity because of new line/
in src code.

any way fix this? thanks!

in comments manual wordwrap() posted code snippet solve issue:

<?php      function textwrap($text) {          $new_text = '';          $text_1 = explode('>',$text);          $sizeof = sizeof($text_1);          ($i=0; $i<$sizeof; ++$i) {              $text_2 = explode('<',$text_1[$i]);              if (!empty($text_2[0])) {                  $new_text .= preg_replace('#([^\n\r .]{25})#i', '\\1  ', $text_2[0]);              }              if (!empty($text_2[1])) {                  $new_text .= '<' . $text_2[1] . '>';                 }          }          return $new_text;      }  ?> 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -