[Tickets #2420] NEW: MIME_Viewer_source::lineNumber

bugs@bugs.horde.org bugs at bugs.horde.org
Wed Aug 10 05:11:22 PDT 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=2420
-----------------------------------------------------------------------
 Ticket             | 2420
 Created By         | mboerger at ford.com
 Summary            | MIME_Viewer_source::lineNumber
 Queue              | Horde Base
 Version            | 3.0.5
 State              | Unconfirmed
 Priority           | 1. Low
 Type               | Bug
 Owners             | 
-----------------------------------------------------------------------


mboerger at ford.com (2005-08-10 05:11) wrote:

Line numbering does not work for me because line numbers and source are
treated differently. The solution is to change the method as follows:

    /**
     * Add line numbers to a block of code.
     *
     * @param string $code  The code to number.
     */
    function lineNumber($code, $linebreak = "\n")
    {
        $code = explode($linebreak, $code);
        $html  = '<table style="border: 1px solid black" cellspacing="0"
cellpadding="0" width="100%">';
        foreach($code as $l => $text) {
            $html .= '<tr><td valign="top" style="background-color:#e9e9e9;
padding-left:10px; padding-right:10px; text-align:right;
font-family:monospace; font-size:12px;">';
            $html .= sprintf('<a style="font-family:monospace;
font-size:12px;" name="%s" href="#%s">%s</a>', $l, $l, $l) . '</td>';
            $html .= '<td width="100%" valign="top" nowrap="nowrap"
style="background-color:white; padding-left:10px; font-family:monospace;
font-size:12px;">' . $text . '</td>';
            $html .= '</tr>';
        }
        return $html . '</table>';
    }





More information about the bugs mailing list