PHP expert |
|
[code]htmlrnheadrnstyle type=textcssrnrn.codeblockrn{rn padding 0px;rn position relative;rn}rnrn.codeblock .codern{rn padding-left 50px;rn width 500px;rn background #EEE;rn border-right 1px solid #666;rn border-bottom 1px solid #666;rn border-top 1px solid #666;rn white-space nowrap;rn overflow auto;rn}rnrn.codeblock .linenumbersrn{rn position absolute;rn top 0px;rn width 40px;rn padding 0px 3px 0px 0px;rn text-align right;rn background #DDD;rn border 1px solid #666;rn vertical-align top;rn}rnrn.codeblock .linenumbersrn{rn top -13px;rn}rnstylernheadrnbodyrnrnphprnerror_reporting(E_ALL);rnrnfunction regelnummers($str)rn{rnrn $insstr = highlight_string($str, true);rn $times = 1 + substr_count($insstr, 'br ');rnrn $ret = 'div class=codeblockpre class=linenumbers';rnrn for($i = 1; $i = $times; $i++)rn {rn $ret .= $i . n;rn }rnrn $ret .= 'prediv class=code' . $insstr . 'divdiv';rnrn return $ret;rn}rnrnecho regelnummers('phprnrnfunction line_wrap($str, $cols = 60, &$arr)rn{rn # Lange regel Lange regel Lange regel Lange regel Lange regel Lange regel Lange regel Lange regel Lange regel Lange regel regel Lange regel Lange regel Lange regel Lange regel Lange regel.rnrn $lines = explode(n, $str);rn $newlines = array();rn $linecount = array();rnrn foreach($lines as $nr = $line)rn {rn $times = floor(strlen($line) $cols);rn $newlines[] = chunk_split($line, $cols, n);rn $linecount[$nr + 1] = $times;rn }rnrn $arr = $linecount;rn $ret = implode(, $newlines);rn return $ret;rn}rnrn');rnrnbodyrnhtml[code] rnrnDit doet wel een beetje raar in FF als je terug naar het begin scrollt. |