[imp] Re: [patch] MIME_Viewer_source

Daniel Eckl daniel.eckl at gmx.de
Thu Dec 18 06:22:03 PST 2003


Patch seems to be broken. Sorry.
Here it is again.

> Here is my first suggestion to that problem as attachement.
>
> What do you think?

Greets,
Daniel
-------------- next part --------------
--- MIME/MIME/Viewer/source.php.orig	Thu Dec 18 14:39:00 2003
+++ MIME/MIME/Viewer/source.php	Thu Dec 18 15:14:16 2003
@@ -24,14 +24,15 @@
      */
     function lineNumber($code, $linebreak = "\n")
     {
-        $lines = substr_count($code, $linebreak) + 1;
+        $lines = split($linebreak, $code);
         $html  = '<table style="border: 1px solid black" cellspacing="0" cellpadding="0" width="100%">';
-        $html .= '<tr><td valign="top" style="background-color:#e9e9e9; padding-left:10px; padding-right:10px; text-align:right;">';
-        for ($l = 1; $l <= $lines; $l++) {
-            $html .= sprintf('<a style="font-family:monospace;" name="%s" href="#%s">%s</a><br />', $l, $l, $l) . "\n";
+        foreach ($lines as $key => $thisline)
+        {
+          $nr = $key + 1;
+          $html .= '<tr><td valign="top" style="background-color:#e9e9e9; padding-left:10px; padding-right:10px; text-align:right;">' . $nr . '</td>';
+          $html .= '<td width="100%" valign="top" style="background-color:white; padding-left:10px; font-family:monospace;">' . $thisline . '</td></tr>';
         }
-        $html .= '</td><td width="100%" valign="top" style="background-color:white; padding-left:10px; font-family:monospace;">' . $code . '</td>';
-        return $html . '</tr></table>';
+        return $html . '</table>';
     }
 
 }


More information about the imp mailing list