EZE Posted March 2, 2007 Share Posted March 2, 2007 Okay, I've been trying to make a bbcode parser for google video, so that a user can input [gvid]http://video.google.com/videoplay?docid=VARIABLE ID[/gvid] and it will turn into this: <embed style=\"width:400px;height:326px;\" id=\"VideoPlayback\" type=\"application/x-shockwave-flash\" src=\"http://video.google.com/googleplayer.swf?docId=[b]VARIABLE ID[/b]&hl=en\" quality=\"best\" FlashVars=\"playerMode=embedded\"/> This is my code so far: <? $send = $_POST['send']; $text = $_POST['text']; if(!$send){ echo '<form action="" method="post"><textarea name="text"/></textarea><input type="submit" name="send"/></form>'; } elseif($send){ function gvid($gid) { if(preg_match("/\[gvid\]http:\/\/video.google.com\/videoplay?docid=(.*?)\[\/gvid\]/ise", $text)) { $gid = str_replace("http://video.google.com/videoplay?docid=", "", $gid); $gid = "<embed style=\"width:400px;height:326px;\" id=\"VideoPlayback\" type=\"application/x-shockwave-flash\" src=\"http://video.google.com/googleplayer.swf?docId=$gid&hl=en\" quality=\"best\" FlashVars=\"playerMode=embedded\"/>"; } return $gid; } gvid($text); echo $text; } ?> But when I enter text with the [gvid] code, it comes out as plain text. What should I do? Link to comment https://forums.phpfreaks.com/topic/40931-solved-google-video-bbcode/ Share on other sites More sharing options...
EZE Posted March 2, 2007 Author Share Posted March 2, 2007 *bump* Link to comment https://forums.phpfreaks.com/topic/40931-solved-google-video-bbcode/#findComment-198245 Share on other sites More sharing options...
EZE Posted March 3, 2007 Author Share Posted March 3, 2007 *second bump* Link to comment https://forums.phpfreaks.com/topic/40931-solved-google-video-bbcode/#findComment-198566 Share on other sites More sharing options...
EZE Posted March 5, 2007 Author Share Posted March 5, 2007 Never Mind, I solved it: <?php $send = $_POST['send']; $text = $_POST['text']; if(!$send){ echo '<form action="" method="post"><textarea name="text"/></textarea><input type="submit" name="send"/></form>'; } elseif($send){ function gvid($gid) { $gid = str_replace("http://video.google.com/videoplay?docid=", "", $gid); $someit = "<embed style=\"width:400px;height:326px;\" id=\"VideoPlayback\" type=\"application/x-shockwave-flash\" src=\"http://video.google.com/googleplayer.swf?docId=$gid&hl=en\" quality=\"best\" FlashVars=\"playerMode=embedded\"/>"; return $someit; } while(preg_match("/\[gvid\](.*?)\[\/gvid\]/ise", $text, $matches)) { $text = str_replace($matches[0], gvid($matches[1]), $text); } echo $text; } ?> Link to comment https://forums.phpfreaks.com/topic/40931-solved-google-video-bbcode/#findComment-199543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.