UBB code
ik heb een probleempje met mijn ubb - code.
Hij wil niet werken.
En ik kan de fout niet vinden ?
Kan iemand me helpen.
Dit is het script :
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?
function replace($text){
$text = htmlspecialchars($text);
$text = nl2br($text);
$text = preg_replace("#\[b\](.*?)\[/b\]#si","<b>\\1</b>", $text);
$text = preg_replace("#\[u\](.*?)\[/u\]#si","<u>\\1</u>", $text);
$text = preg_replace("#\[i\](.*?)\[/i\]#si","<i>\\1</i>", $text);
$text = preg_replace("#\[url\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\1</a>", $text);
$text = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\2</a>", $text);
$text = preg_replace("#\[img\](.*?)\[/img\]#si","<img src=\\1>", $text);
$text = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si","<font color=\\1>\\2</font>", $text);
$text = preg_replace("#\[move\](.*?)\[/move\]#si","<marquee>\\1</marquee>", $text);
$text = preg_replace("#\[edit\](.*?)\[/edit\]#si","<font color=orange><b>Edit</b></font>: \\1", $text);
}
$text = $row['profieltekst'];
echo $text;
?>
function replace($text){
$text = htmlspecialchars($text);
$text = nl2br($text);
$text = preg_replace("#\[b\](.*?)\[/b\]#si","<b>\\1</b>", $text);
$text = preg_replace("#\[u\](.*?)\[/u\]#si","<u>\\1</u>", $text);
$text = preg_replace("#\[i\](.*?)\[/i\]#si","<i>\\1</i>", $text);
$text = preg_replace("#\[url\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\1</a>", $text);
$text = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\2</a>", $text);
$text = preg_replace("#\[img\](.*?)\[/img\]#si","<img src=\\1>", $text);
$text = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si","<font color=\\1>\\2</font>", $text);
$text = preg_replace("#\[move\](.*?)\[/move\]#si","<marquee>\\1</marquee>", $text);
$text = preg_replace("#\[edit\](.*?)\[/edit\]#si","<font color=orange><b>Edit</b></font>: \\1", $text);
}
$text = $row['profieltekst'];
echo $text;
?>
Ik hoop dat jullie me kunnen helpen ;)
je roept de functie nergens aan, en hij geeft volgens mij ook geen output. maar zoveel weet ik niet van functies af..
De functie roepen?
dit even.
edit
probeer dit eens:
ik weet het niet precies hoor, maar lees edit
probeer dit eens:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
function replace($text){
$text = htmlspecialchars($text);
$text = nl2br($text);
$text = preg_replace("#\[b\](.*?)\[/b\]#si","<b>\\1</b>", $text);
$text = preg_replace("#\[u\](.*?)\[/u\]#si","<u>\\1</u>", $text);
$text = preg_replace("#\[i\](.*?)\[/i\]#si","<i>\\1</i>", $text);
$text = preg_replace("#\[url\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\1</a>", $text);
$text = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\2</a>", $text);
$text = preg_replace("#\[img\](.*?)\[/img\]#si","<img src=\\1>", $text);
$text = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si","<font color=\\1>\\2</font>", $text);
$text = preg_replace("#\[move\](.*?)\[/move\]#si","<marquee>\\1</marquee>", $text);
$text = preg_replace("#\[edit\](.*?)\[/edit\]#si","<font color=orange><b>Edit</b></font>: \\1", $text);
}
$text = replace($row['profieltekst']);
echo $text;
?>
function replace($text){
$text = htmlspecialchars($text);
$text = nl2br($text);
$text = preg_replace("#\[b\](.*?)\[/b\]#si","<b>\\1</b>", $text);
$text = preg_replace("#\[u\](.*?)\[/u\]#si","<u>\\1</u>", $text);
$text = preg_replace("#\[i\](.*?)\[/i\]#si","<i>\\1</i>", $text);
$text = preg_replace("#\[url\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\1</a>", $text);
$text = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\2</a>", $text);
$text = preg_replace("#\[img\](.*?)\[/img\]#si","<img src=\\1>", $text);
$text = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si","<font color=\\1>\\2</font>", $text);
$text = preg_replace("#\[move\](.*?)\[/move\]#si","<marquee>\\1</marquee>", $text);
$text = preg_replace("#\[edit\](.*?)\[/edit\]#si","<font color=orange><b>Edit</b></font>: \\1", $text);
}
$text = replace($row['profieltekst']);
echo $text;
?>
Gewijzigd op 01/01/1970 01:00:00 door Erwin Nieuwenhuis
Volgens mij kan het ook zonder.
Maar wat heb je eigenlijk verandert aan dat script?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
function replace($text)
{
$text = htmlspecialchars($text);
$text = nl2br($text);
$text = preg_replace("#\[b\](.*?)\[/b\]#si","<b>\\1</b>", $text);
$text = preg_replace("#\[u\](.*?)\[/u\]#si","<u>\\1</u>", $text);
$text = preg_replace("#\[i\](.*?)\[/i\]#si","<i>\\1</i>", $text);
$text = preg_replace("#\[url\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\1</a>", $text);
$text = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\2</a>", $text);
$text = preg_replace("#\[img\](.*?)\[/img\]#si","<img src=\\1>", $text);
$text = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si","<font color=\\1>\\2</font>", $text);
$text = preg_replace("#\[move\](.*?)\[/move\]#si","<marquee>\\1</marquee>", $text);
$text = preg_replace("#\[edit\](.*?)\[/edit\]#si","<font color=orange><b>Edit</b></font>: \\1", $text);
return $text;
}
$text = replace($row['profieltekst']);
echo $text;
?>
function replace($text)
{
$text = htmlspecialchars($text);
$text = nl2br($text);
$text = preg_replace("#\[b\](.*?)\[/b\]#si","<b>\\1</b>", $text);
$text = preg_replace("#\[u\](.*?)\[/u\]#si","<u>\\1</u>", $text);
$text = preg_replace("#\[i\](.*?)\[/i\]#si","<i>\\1</i>", $text);
$text = preg_replace("#\[url\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\1</a>", $text);
$text = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\2</a>", $text);
$text = preg_replace("#\[img\](.*?)\[/img\]#si","<img src=\\1>", $text);
$text = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si","<font color=\\1>\\2</font>", $text);
$text = preg_replace("#\[move\](.*?)\[/move\]#si","<marquee>\\1</marquee>", $text);
$text = preg_replace("#\[edit\](.*?)\[/edit\]#si","<font color=orange><b>Edit</b></font>: \\1", $text);
return $text;
}
$text = replace($row['profieltekst']);
echo $text;
?>
Gewijzigd op 01/01/1970 01:00:00 door Erwin Nieuwenhuis
Maar dat had ik in het begin ook maar dat werkte niet!
Met mijn script geeft het de tekst wel weer maar hij doet niet wat hij moet doen.
En met die replace laat hij niks van de tekst zien
je moet die regel 20, 'return $text;' ook nog even toevoegen.
jah, was een edit van mijn kant. :)