display text retrieved with html tags

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikaspa
    New Member
    • Nov 2006
    • 4

    display text retrieved with html tags

    In one of the web sites I Really got an excellent code to convert text entered in ms word to html format

    I am using following code for conversion

    Code:
    <?php 
    $txt= superhtmlentities($rrows['detail']);
    echo $txt ;?>
    
    The function is given below
     function superhtmlentities($text) { 
    $entities = array(128 => 'euro', 130 => 'sbquo', 131 => 'fnof', 132 => 'bdquo', 133 => 'hellip', 134 => 'dagger', 135 => 'Dagger', 136 => 'circ', 137 => 'permil', 138 => 'Scaron', 139 => 'lsaquo', 140 => 'OElig', 145 => 'lsquo', 146 => 'rsquo', 147 => 'ldquo', 148 => 'rdquo', 149 => 'bull', 150 => '#45', 151 => 'mdash', 152 => 'tilde', 153 => 'trade', 154 => 'scaron', 155 => 'rsaquo', 156 => 'oelig', 159 => 'Yuml'); 
    $new_text = ''; 
    for($i = 0; $i < strlen($text); $i++) { 
    $num = ord($text{$i}); 
    if (array_key_exists($num, $entities)) { 
    switch ($num) { 
    case 150: 
    $new_text .= '-'; 
    break; 
    default: 
    $new_text .= '&'.$entities[$num].';'; 
    } 
    } 
    else 
    if($num < 127 || $num > 159) { 
    $new_text .= htmlentities($text{$i}); 
    } 
    } 
    return $new_text; 
    }
    where superhtmlentiti es is function defined in this section above

    the output i.e. $txt stores

    <p><b>The pages in this section will give the details of various hospitals and the centers for special treatments in Mumbai. The addresses and contact details for the same have been provided. This page is updated with the special concessions that are provided to Senior Citizens wherever available.</b></p>

    which is text with an html code ,,,
    How can i display this as nomal text with html format

    how to display it ?

    Help

    Thanks in advance
    Last edited by Markus; Nov 14 '08, 07:43 PM. Reason: added # tags
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Using htmlentities causes this. Remove the htmlentities() function on line 22

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Vikaspa, when posting code on the forums, use [code] tags. To do this, highlight the code and then hit the '#' button (not the one on your keyboard) at the top of where you enter your text. Read the Posting Guidelines if you are unsure how to do this.

      Moderator.

      Comment

      Working...