hat jemand eine idee wie man die zeilenzahlen dazugebn kann?
also ich mein falls jemand
<?php
//Globale Variablen einlesen // Wird nur $border=0 übertragen
require("inc/global.inc.php");
...
..
...
...
?>
das links dann die zeilenzahl steht
Ort: / Boardübersicht / Vorschläge / php formatierung
Seite 1 von 1
hat jemand eine idee wie man die zeilenzahlen dazugebn kann?
also ich mein falls jemand
<?php
//Globale Variablen einlesen // Wird nur $border=0 übertragen
require("inc/global.inc.php");
...
..
...
...
?>
das links dann die zeilenzahl steht
Selbst wenn es gehen würde, verstehe ich nicht ganz den Sinn !
2.85
naja falls jemand einen extrem langen code postet könnte man so viel schneller eine bestimmte zeile finden
[no comment]
schau dir das an:
thwbcode.inc.php
function format_code($a)
{
global $config;
$a = str_replace(array('\"', ' ', "\n"), array('"', ' ', '<br />'), trim($a));
$t = '';
if(empty($config['code_line_numbers']))
{
$t = '<code>'.$a.'</code>';
}
else
{
$t = format_numbered($a);
}
return '<br /><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1" class="color4">'
.'<tr><td><span class="smallfont"><b class="hefo">Quellcode:</b></span></td></tr>'
.'<tr class="cella"><td>'.$t.'</td></tr></table><br />';
}
function format_php($a)
{
global $config;
$a = str_replace(array('"', ' ', "<br>", '<', '>', '''), array('"', ' ', "\n", '<', '>', '\''), $a);
if((float)(phpversion()) >= 4.2)
{
//ttt: automatically insert < ?php if necessary
if( !preg_match( '/^\<\?(php)?/s', $a ) )
$a = "<?php\n". $a;
if( !preg_match( '/\?\>$/s', $a ) )
$a .= "\n?>";
$a = highlight_string($a, TRUE);
}
else
{
$a = str_replace(array('"', ' ', "\n", '<', '>', '\''), array('"', ' ', "<br>", '<', '>', '''), $a);
}
if(empty($config['code_line_numbers']))
{
$t = '<code>'.$a.'</code>';
}
else
{
$t = format_numbered($a);
}
return '<br /><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1" class="color4">'
.'<tr><td><span class="smallfont"><b class="hefo">Quellcode:</b></span></td></tr>'
.'<tr class="cella"><td>'.$t.'</td></tr></table><br />';
}
function format_numbered($a)
{
$lines = (substr_count($a, '<br />') + 1);
$numbers = '<code>';
for($i = 1; $i <= $lines; ++$i)
{
$numbers .= sprintf('%02d:<br />', $i);
}
$numbers .= '</code>';
return '<table><tr><td>'.$numbers.'</td><td><code>'.$a.'</code></td></tr></table>';
}
Seite 1 von 1