It works like this to convert an RTF file into HTML and display the code on the webpage. it uploads an RTF file and converts it to HTML for display. the code is a bit complicated, teaman needs to study it well, as if the Chinese version is a bit problematic. & Nbsp; & lt; html & gt; & nbsp; & lt; b. convert an RTF file to HTML and display the code on the webpage.
This is how it works. it uploads an RTF file and converts it to HTML for display. the code is a bit complicated and teaman needs to study it well, as if the Chinese version is a bit problematic.
If (! ($ Userfile )){
?>
Exit;
}
Function ProcessTags ($ tags, $ line ){
$ Html = "";
Global $ color;
Global $ size;
Global $ bullets;
// Remove spaces.
$ Tags = trim ($ tags );
// Found the beginning of the bulleted l
// Ist.
If (ereg ("\ pnindent", $ tags )){
$ Html. ="
- ";
$ Bullets + = $ line;
$ Tags = ereg_replace ("\ par", "", $ tags );
$ Tags = ereg_replace ("\ (tab)", "", $ tags );
}
If ($ line-$ bullets = 0 ){
$ Tags = ereg_replace ("\ par", "", $ tags );
}
Elseif ($ line-$ bullets = 1 ){
If (ereg ("\ pntext", $ tags )){
$ Html. ="
- ";
$ Tags = ereg_replace ("\ par", "", $ tags );
$ Tags = ereg_replace ("\ (tab)", "", $ tags );
$ Bullets ++;
}
Else {
$ Html. ="
";
$ Bullets = 0;
}
}
// Convert Bold.
If (ereg ("\ 0", $ tags) {$ html. ="";}
Elseif (ereg ("\", $ tags) {$ html. ="
";}
// Convert Italic.
If (ereg ("\ i0", $ tags) {$ html. ="";}
Elseif (ereg ("\ I", $ tags) {$ html. ="";}
// Convert Underline.
If (ereg ("\ ulnone", $ tags) {$ html. ="";}
Elseif (ereg ("\ ul", $ tags) {$ html. ="";}
// Convert Alignments.
If (ereg ("\ pard \ qc", $ tags) {$ html. = "";}
Elseif (ereg ("\ pard \ qr", $ tags) {$ html. = "";}