Seite 1 von 2

webadressen automatisch als link?

Verfasst: 21.07.2004 00:49
von danysahne333
wenn ich eine webadresse in einem posting schreibe. z.b. www.test.de dann wird diese adresse generell als link dargestellt obwohl ich keine url-tags benutzt habe.

wie kann ich das ändern???

Verfasst: 21.07.2004 01:03
von Fabse
Da müsstest du die includes/bbcode.php ändern.

Bin mir nicht sicher, aber versuch mal das:

Code: Alles auswählen

function make_clickable($text)
{

	// pad it with a space so we can match things at the start of the 1st line.
	$ret = ' ' . $text;

	// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
	// xxxx can only be alpha characters.
	// yyyy is anything up to the first space, newline, comma, double quote or <
	$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); 

	// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
	// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
	// zzzz is optional.. will contain everything up to the first space, newline, 
	// comma, double quote or <.
	$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);

	// matches an email@domain type address at the start of a line, or after a space.
	// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
	$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);

	// Remove our padding..
	$ret = substr($ret, 1);

	return($ret);
Ersetze mit:

Code: Alles auswählen

/*function make_clickable($text)
{

	// pad it with a space so we can match things at the start of the 1st line.
	$ret = ' ' . $text;

	// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
	// xxxx can only be alpha characters.
	// yyyy is anything up to the first space, newline, comma, double quote or <
	$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); 

	// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
	// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
	// zzzz is optional.. will contain everything up to the first space, newline, 
	// comma, double quote or <.
	$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);

	// matches an email@domain type address at the start of a line, or after a space.
	// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
	$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);

	// Remove our padding..
	$ret = substr($ret, 1);

	return($ret);*/

Verfasst: 21.07.2004 12:15
von danysahne333
wenn ich das mache bekomme ich folgende fehlermeldung:
Parse error: parse error in /home/www/web159/html/includes/bbcode.php on line 718

Parse error: parse error in /home/www/web159/html/includes/bbcode.php on line 718

Warning: Cannot modify header information - headers already sent by (output started at /home/www/web159/html/includes/bbcode.php:718) in /home/www/web159/html/includes/sessions.php on line 311

Warning: Cannot modify header information - headers already sent by (output started at /home/www/web159/html/includes/bbcode.php:718) in /home/www/web159/html/includes/sessions.php on line 312

Warning: Cannot modify header information - headers already sent by (output started at /home/www/web159/html/includes/bbcode.php:718) in /home/www/web159/html/includes/functions.php on line 796

hast du noch ne idee?

Verfasst: 21.07.2004 12:28
von Christian_W

Code: Alles auswählen

----- öffne -----
includes/bbcode.php

----- finde -----
function make_clickable($text)
{

----- füge danch ein -----
	return($text); //exit function without doing anything
Gruß Christian

Verfasst: 21.07.2004 12:36
von danysahne333
jetzt bekomme ich leider folgenden fehler.
Parse error: parse error in /home/www/web159/html/includes/bbcode.php on line 720

Warning: Cannot modify header information - headers already sent by (output started at /home/www/web159/html/includes/bbcode.php:720) in /home/www/web159/html/includes/page_header.php on line 607

Warning: Cannot modify header information - headers already sent by (output started at /home/www/web159/html/includes/bbcode.php:720) in /home/www/web159/html/includes/page_header.php on line 609

Warning: Cannot modify header information - headers already sent by (output started at /home/www/web159/html/includes/bbcode.php:720) in /home/www/web159/html/includes/page_header.php on line 610

Verfasst: 21.07.2004 13:27
von Christian_W
Verlinke mal Deine bbcode.php
KB:datei

Gruß Christian

Verfasst: 21.07.2004 13:34
von danysahne333

Verfasst: 21.07.2004 14:12
von Christian_W
Die Änderungen von Fabse musst Du natürlich zuerst wieder rückgänig machen. ;)

Du kannst ein Funktion die Du nicht benutzen willst nicht einfach auskommentieren. Entweder rufst Du diese erst gar nicht auf oder gibst direkt am Anfang der Funktion den übergebenen Wert unverändert wieder zurück. (Das ist genau das was meine Änderung macht.)

Gruß Christian

Verfasst: 21.07.2004 14:39
von Fabse
Ok, merk ich mir fürs nächste mal! ;)

Verfasst: 21.07.2004 16:11
von danysahne333
Christian_W hat geschrieben:Die Änderungen von Fabse musst Du natürlich zuerst wieder rückgänig machen. ;)

Du kannst ein Funktion die Du nicht benutzen willst nicht einfach auskommentieren. Entweder rufst Du diese erst gar nicht auf oder gibst direkt am Anfang der Funktion den übergebenen Wert unverändert wieder zurück. (Das ist genau das was meine Änderung macht.)

Gruß Christian
so s funktioniert jetzt nur gibs eine neues problem:

wenn ich jetzt was schreibe hab ich die ganze zeit sowas hier :

http://www.cottbustalk.de/bilder/problem.jpg

hat da wer ne idee?