Hallo mal wieder , 
da ich men kleines newsscript weiter tunen möchte , hab ich mir einen weiteren Codeschnipsel besorgt , der zb. geschriebene Smilies in Bilder umwandelt. Ich habe folgenden code aus einem Gästebuch rausgenommen und weiß jetzt aber nicht wie ich diesen Einbauen soll. Hier mal der code :
	
Und hier der Code der die Daten ausliest ( den kennt ihr bestimmt noch 
 
  
  )
 )
	
Vielen Dank für eure Hilfe , fühle mich schon richtig Heimischi hier im Forum 
							
						
					da ich men kleines newsscript weiter tunen möchte , hab ich mir einen weiteren Codeschnipsel besorgt , der zb. geschriebene Smilies in Bilder umwandelt. Ich habe folgenden code aus einem Gästebuch rausgenommen und weiß jetzt aber nicht wie ich diesen Einbauen soll. Hier mal der code :
PHP-Code:
	
	
<?php
$eintrag = $line["Beitrag"];
function replace($eintrag) {
   $eintrag =  str_replace("\r ", "<br>", $eintrag);
   $eintrag =  str_replace(":-)", "<img src="smiley.gif" border="0" alt="" title="">", $eintrag)";
   $eintrag =  str_replace(":)", "<img src="smiley.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(";-)", "<img src="wink.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(";)", "<img src="wink.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":-(", "<img src="sad.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":(", "<img src="sad.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":-D", "<img src="grin.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":D", "<img src="grin.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace("(H)", "<img src="cool.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace("(h)", "<img src="cool.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":-O", "<img src="shocked.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":O", "<img src="shocked.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":P", "<img src="tongue.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":p", "<img src="tongue.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":S", "<img src="lipsrsealed.gif" border="0" alt="" title="">", $eintrag);
   $eintrag =  str_replace(":s", "<img src="lipsrsealed.gif" border="0" alt="" title="">", $eintrag);
return $eintrag;
}
?>
 
  
  )
 )PHP-Code:
	
	
<?php
$link=mysql_connect("", "", "") or die("Keine Verbindung möglich!<br />".mysql_error()."<p />");
print "";
mysql_select_db("") or die("Auswahl der Datenbank fehlgeschlagen<br />".mysql_error()."<p />");
$query = "SELECT * FROM news ORDER BY(id) DESC LIMIT 0,2";
$result = mysql_query($query) or die("Anfrage fehlgeschlagen<br />".mysql_error()."<p />");
print "<center>\n";
print "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"47%\" id=\"AutoNumber1\" height=\"123\">";
$line["id"];
$line["Name"];
$line["Email"];
$line["Titel"];
$line["beitrag"];
$line["Datum"];
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
  $timestamp= $line["Datum"];
  $Jahr = substr($timestamp,0,4);
  $Monat = substr ($timestamp,4,2);
  $Tag = substr ($timestamp,6,2);
  $Std = substr ($timestamp,8,2);
  $Min = substr ($timestamp,10,2);
  $Sec = substr ($timestamp,12,2);
echo "<meta http-equiv=\"Content-Language\" content=\"de\">";
echo "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"47%\" id=\"AutoNumber1\" height=\"123\">";
echo "<tr>";
echo "<td width=\"33%\" height=\"19\" bgcolor=\"#CC9900\"><b>Autor</b>: ".$line["Name"]."                  <a href=\"mailto:".$line["Email"]."\"><img border=\"0\" src=\"/images/folder.gif\"></a></td>";
echo "<td width=\"34%\" height=\"19\" bgcolor=\"#CC9900\"><b>Titel</b>: ".$line["Titel"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"100%\" colspan=\"2\" height=\"137\" bgcolor=\"#CC9900\">".$line["Beitrag"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"33%\" colspan=\"2\" height=\"1\" bgcolor=\"#CC9900\"><b>Eingetragen am</b>: $Tag.$Monat.$Jahr um $Std:$Min:$Sec </td>";
echo "</tr>";
echo "<br>";
}
print "</table>\n";
print "</center>\n<br>";
mysql_free_result($result);
mysql_close($link);
?>
 
							
						 
          





Kommentar