Sie sind hier : sebastian1012.bplaced.net/ homepage-neu / Kurze-Scripte-und-Codeschnipsel / index.php

Zurück


Der Quellcode dazu


 
= 4.0.1, PHP 5
 *
 *	Hebt Syntax hervor incl. Zeilenzahlen
 *
 * 	LICENSE: GNU General Public License (GPL)
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License version 2,
 *	as published by the Free Software Foundation.
 *
 *	@category   CURL
 *	@author     Damir Enseleit 
 *	@copyright  2001-2006 SELFPHP
 *	@version    $Id: file_number.php,v 0.10 2006/04/16 14:21:10 des1 Exp $
 *	@link       http://www.selfphp.de
 */

/**
 * Hebt Syntax hervor incl. Zeilenzahlen
 *
 * @param		string			$file			Die darzustellende Datei
 * @param		string			$table		Tabelle fuer Darstellung
 * @param		bool				$print		Direkte Ausgabe
 *
 * @return	mixed													
 */

function lineNumber($file, $table, $print=false)
{
	
	$content = highlight_file($file,TRUE);
	
	$ex_line = file($file);
	
	$lines = count($ex_line);
	
	$length = strlen($lines);
	
	for($x=1;$x<=$lines;$x++)
	{
		$ausgabe .= str_pad($x, $length, "0", STR_PAD_LEFT);
		$ausgabe .= ":
"; } $table = @preg_replace('/{lineNumber}/',$ausgabe,$table); $table = @preg_replace('/{phpHighlight}/',$content,$table); if($print === false) { return $table; } else { echo $table; } } $table .= ''; $table .= ''; $table .= ''; $table .= '
'; $table .= '{lineNumber}'; $table .= '{phpHighlight}
'; $lineNum = lineNumber("highlighting.php",$table,true); ?>

Add Comment

* Required information
1000
Powered by Commentics

Comments (1)

Gravatar
Admin
Sascha65says...

Die Canvas Balken Uhr ist ja mal Fett