Seite 1 von 1

habe problem mit dem zeilen anzeigen bei [code]

Verfasst: 04.03.2006 01:08
von oconner
Hallo ich habe volgendes Installiert

Code: Alles auswählen

# 
#-----[ COPY ]------------------------------------------ 
# codetemp.txt is an empty file that is used for writing and reading.
Codenum/*.* TO Codenum/*.*
# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/bbcode.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
function bbencode_second_pass_code($text, $uid, $bbcode_tpl)
{
	global $lang;

	$code_start_html = $bbcode_tpl['code_open'];
	$code_end_html =  $bbcode_tpl['code_close'];

	// First, do all the 1st-level matches. These need an htmlspecialchars() run,
	// so they have to be handled differently.
	$match_count = preg_match_all("#\[code:1:$uid\](.*?)\[/code:1:$uid\]#si", $text, $matches);

	for ($i = 0; $i < $match_count; $i++)
	{
		$before_replace = $matches[1][$i];
		$after_replace = $matches[1][$i];

		// Replace 2 spaces with "&nbsp; " so non-tabbed code indents without making huge long lines.
		$after_replace = str_replace("  ", "&nbsp; ", $after_replace);
		// now Replace 2 spaces with " &nbsp;" to catch odd #s of spaces.
		$after_replace = str_replace("  ", " &nbsp;", $after_replace);

		// Replace tabs with "&nbsp; &nbsp;" so tabbed code indents sorta right without making huge long lines.
		$after_replace = str_replace("\t", "&nbsp; &nbsp;", $after_replace);

		// now Replace space occurring at the beginning of a line
		$after_replace = preg_replace("/^ {1}/m", '&nbsp;', $after_replace);

		$str_to_match = "[code:1:$uid]" . $before_replace . "[/code:1:$uid]";

		$replacement = $code_start_html;
		$replacement .= $after_replace;
		$replacement .= $code_end_html;

		$text = str_replace($str_to_match, $replacement, $text);
	}

	// Now, do all the non-first-level matches. These are simple.
	$text = str_replace("[code:$uid]", $code_start_html, $text);
	$text = str_replace("[/code:$uid]", $code_end_html, $text);

	return $text;

} // bbencode_second_pass_code()
# 
#-----[ REPLACE, WITH ]------------------------------------------ 
#
function bbencode_second_pass_code($text, $uid, $bbcode_tpl)
{
	global $lang;

	// First, do all the 1st-level matches. These need an htmlspecialchars() run,
	// so they have to be handled differently.
	$match_count = preg_match_all("#\[code:1:$uid\](.*?)\[/code:1:$uid\]#si", $text, $matches);
	$code_start_html = $bbcode_tpl['code_open'];
	$code_end_html =  $bbcode_tpl['code_close'];

	for ($i = 0; $i < $match_count; $i++)
	{
		$tdnumbers = "";
		$before_replace = $matches[1][$i];
		$after_replace = $matches[1][$i];

		$codetemp = fopen('Codenum/codetemp.txt', 'w');
		fwrite($codetemp, $before_replace);
		fclose($codetemp);
		$tempfile = file('Codenum/codetemp.txt');
		foreach ($tempfile as $line_num => $line) {
			// Replace 2 spaces with "&nbsp; " so non-tabbed code indents without making huge long lines.
			$line = str_replace("  ", "&nbsp; ", $line);
			// now Replace 2 spaces with " &nbsp;" to catch odd #s of spaces.
			$line = str_replace("  ", " &nbsp;", $line);
			// Replace tabs with "&nbsp; &nbsp;" so tabbed code indents sorta right without making huge long lines.
			$line = str_replace("\t", "&nbsp; &nbsp;", $line);
			// now Replace space occurring at the beginning of a line
			$line = preg_replace("/^ {1}/m", '&nbsp;', $line);
		  	if ($line_num > 0){
			$tdnumbers = $tdnumbers. '<tr><td width="36" background="Codenum/codenum.png?number='.$line_num.'" valign="top"><span class="gensmall"></span></td>  <td valign="top" style="border-left:1px dotted gray;"><span class="gensmall">' . $line . "</span></td></tr>";
			$tdlines = $tdlines . $line . '<br >';
			}
		}

		$str_to_match = "[code:1:$uid]" . $before_replace . "[/code:1:$uid]";

		$replacement = $code_start_html;
		$replacement .= '<table cellpadding="0" cellspacing="0" border="0">'.$tdnumbers.'</table>';
		$replacement .= $code_end_html;

		$text = str_replace($str_to_match, $replacement, $text);
	}

	return $text;

} // bbencode_second_pass_code()
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcode.tpl
# 
#-----[ FIND ]------------------------------------------ 
# 
<!-- BEGIN code_open --></span>
<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center">
<tr> 
	  <td><span class="genmed"><b>{L_CODE}:</b></span></td>
	</tr>
	<tr>
	  <td class="code"><!-- END code_open -->
# 
#-----[ REPLACE, WITH ]------------------------------------------ 
# 
<!-- BEGIN code_open --></span>
<table width="90%" cellspacing="2" cellpadding="0" border="0" align="center">
<tr> 
	  <td colspan="2"><span class="genmed"><b>{L_CODE}:</b></span></td>
	</tr>
	<tr>
	  <td class="code" valign="top"><!-- END code_open -->
#
#-----[ CHMOD ]------------------------------------------
chmod Codenum/codetemp.txt to 666
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
na und nun siht aber das codefeld total furchbar aus, wiedo, ich hab alles so gemacht wie es dastan

siehe >>> http://oconner.de/webmaster-hilfe.org/v ... highlight=

Verfasst: 04.03.2006 01:17
von oconner
und so sieht s jetzt bei mir aus

weil ich glaube da wurde das tabellen chließen etc. vergessen aber so ist mein code in dr bbcode.tpl

Code: Alles auswählen

<table width="90%" cellspacing="2" cellpadding="0" border="0" align="center">
<tr> 
	  <td colspan="2"><span class="genmed"><b>{L_CODE}:</b></span></td>
	</tr>
	<tr>
	  <td class="code" valign="top"><!-- END code_open -->
	  </tr>
	  </table>
ach ja und der fehler der im momment angezeigt wird soll die </table> zeile sein.

Verfasst: 04.03.2006 01:49
von oconner
ok ich habs hinbekommen sry

ich loesche das mal extra nicht, sonder schreibe noch genau den code von bbcode.tpl hin, vielleicht hat ja auch mal jemand das problem

Code: Alles auswählen

<!-- BEGIN code_open --></span>
<table width="90%" cellspacing="2" cellpadding="0" border="0" align="center">
<tr> 
	  <td colspan="2"><span class="genmed"><b>{L_CODE}:</b></span></td>
	</tr>
	<tr>
	  <td class="code" valign="top"><!-- END code_open -->
<!-- BEGIN code_close --></td>
	</tr>
</table>
<span class="postbody"><!-- END code_close -->