Return is leeg..
Hallo,
ik ben bezig met mijn UBB code parser aleen als ik de youtube tag wil maken krijg ik geen youtube tag van de functie terug, maar hij werkt wel :S
ik ben bezig met mijn UBB code parser aleen als ik de youtube tag wil maken krijg ik geen youtube tag van de functie terug, maar hij werkt wel :S
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
28
29
30
31
32
33
34
35
36
37
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
28
29
30
31
32
33
34
35
36
37
<?php
function GetYoutubeTag($url){
$pos=strpos($url, 'v=');
$pos_start=$pos+2;
$pos_end=11;
$youtubetag=substr($url, $pos_start, $pos_end);
return $youtubetag;
}
function GetYoutubePlayer($input){
list($url, $title) = split('@SPLIT@', $input);
$youtubetag=GetYoutubeTag($url);
$return .="<br><div class='youtubeframe'><div class='youtubeinnerframe'>";
$return .="<center><a onclick=\"javascript:toggleid('youtube_".sha1($url)."');\" href=\"javascript:void(0);\" class='youtubeurl'><b>".$title."</b> (toggle video)</a></center><br/><br/>";
$return .="<div style='display: none;' id='youtube_".sha1($url)."'><center><object width='445' height='364'>";
$return .="<param name='movie' value='http://www.youtube.com/v/".$youtubetag."&hl=nl&fs=1&color1=0x5d1719&color2=0xcd311b&border=1'></param>";
$return .="<param name='allowFullScreen' value='true'></param>";
$return .="<param name='allowscriptaccess' value='always'></param>";
$return .="<embed src='http://www.youtube.com/v/".$youtubetag."&hl=nl&fs=1&color1=0x5d1719&color2=0xcd311b&border=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='445' height='364'></embed>";
$return .="</object></center><br/></div>";
$return .="</div></div>";
return $return;
}
function UBB($string){
$string = htmlentities($string);
$string = htmlspecialchars($string);
$string = nl2br ($string);
$string = preg_replace("#\[youtube=(.+?)\](.+?)\[/youtube\]#is",GetYoutubePlayer("\\1@SPLIT@\\2"),$string);
return $string;
}
?>
function GetYoutubeTag($url){
$pos=strpos($url, 'v=');
$pos_start=$pos+2;
$pos_end=11;
$youtubetag=substr($url, $pos_start, $pos_end);
return $youtubetag;
}
function GetYoutubePlayer($input){
list($url, $title) = split('@SPLIT@', $input);
$youtubetag=GetYoutubeTag($url);
$return .="<br><div class='youtubeframe'><div class='youtubeinnerframe'>";
$return .="<center><a onclick=\"javascript:toggleid('youtube_".sha1($url)."');\" href=\"javascript:void(0);\" class='youtubeurl'><b>".$title."</b> (toggle video)</a></center><br/><br/>";
$return .="<div style='display: none;' id='youtube_".sha1($url)."'><center><object width='445' height='364'>";
$return .="<param name='movie' value='http://www.youtube.com/v/".$youtubetag."&hl=nl&fs=1&color1=0x5d1719&color2=0xcd311b&border=1'></param>";
$return .="<param name='allowFullScreen' value='true'></param>";
$return .="<param name='allowscriptaccess' value='always'></param>";
$return .="<embed src='http://www.youtube.com/v/".$youtubetag."&hl=nl&fs=1&color1=0x5d1719&color2=0xcd311b&border=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='445' height='364'></embed>";
$return .="</object></center><br/></div>";
$return .="</div></div>";
return $return;
}
function UBB($string){
$string = htmlentities($string);
$string = htmlspecialchars($string);
$string = nl2br ($string);
$string = preg_replace("#\[youtube=(.+?)\](.+?)\[/youtube\]#is",GetYoutubePlayer("\\1@SPLIT@\\2"),$string);
return $string;
}
?>
Debuggen he..
Stop wat vardumpjes erin, kijk tot hoe ver hij komt..
Stop wat vardumpjes erin, kijk tot hoe ver hij komt..
Je moet de functies ook nog aanroepen, he.
die function UBB behalve de bovenste wel .= gebruiken
en return string i.p.v. strings
en return string i.p.v. strings
'Twan:
die function UBB behalve de bovenste wel .= gebruiken
Uhh, nee, anders krijgt hij een nog foutere output
'Twan:
en return string i.p.v. strings
Waar zie je 'strings' staan? :P
jah, dat vraag ik me ook even af :P
In de parameter?
'Gerritjan:
In de parameter?
Sorry hoor, maar zelfs in notepad de 'zoekfunctie' kan 'strings' niet vinden... >_<
Hee vreemd!!
ik heb het ff zo gedaan om te debuggen maar de output is wel heel erg raar.
A: \1
ik heb het ff zo gedaan om te debuggen maar de output is wel heel erg raar.
Code (php)
A: \1
Dan gaat het daarvoor dus fout :)
hmm
het gaat gelijk hier al fout:
Want als je de waarder van \\1 of \\2 wilt echo'n dan krijg je een \1 of een \2 maar return werkt wel weer :S
het gaat gelijk hier al fout:
Code (php)
1
2
3
2
3
<?php
$string = preg_replace("#\[youtube=(.+?)\](.+?)\[/youtube\]#is",GetYoutubePlayer("\\1@SPLIT@\\2"),$string);
?>
$string = preg_replace("#\[youtube=(.+?)\](.+?)\[/youtube\]#is",GetYoutubePlayer("\\1@SPLIT@\\2"),$string);
?>
Want als je de waarder van \\1 of \\2 wilt echo'n dan krijg je een \1 of een \2 maar return werkt wel weer :S




