Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

integrating bbcode for youtube in custom forum.

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

integrating bbcode for youtube in custom forum.

Postby Serifaz » Sun Feb 03, 2013 10:03 pm

Hello I am trying to integrate youtube tags into my forum I am building.
I called the tags [vid][/vid] I would like to be able to just input the youtube id to embed it in the post this is what I have sofar for the bbcode.
can someone tell me what Im doing wrong? Currently it posts a blank flash image with the id of the video on the side.

Code: Select all
function bb($r) {

$r = trim($r);
$r = htmlentities($r);
$r = nl2br($r);
$r = str_replace("  "," ",$r);
$r = str_replace("[vid]","<object width='425' height='350'><param name='movie' value='{param}'></param><embed src='{param}' type='application/x-shockwave-flash' width='425' height='350'></embed></object>",$r);
$r = str_replace("[/vid]","",$r);
$r = str_replace("\r\n","<br>",$r);
$r = str_replace("[b]","<b>",$r);
$r = str_replace("[/b]","</b>",$r);
$r = str_replace("[img]","<img src='",$r);
$r = str_replace("[/img]","'>",$r);
$r = str_replace("[IMG]","<img src='",$r);
$r = str_replace("[/IMG]","'>",$r);
$r = str_replace("[s]","<s>",$r);
$r = str_replace("[/s]","</s>",$r);
$r = str_replace("[ul]","<ul>",$r);
$r = str_replace("[/ul]","</ul>",$r);
$r = str_replace("[li]","<li>",$r);
$r = str_replace("[/li]","</li>",$r);
$r = str_replace("[ol]","<ol>",$r);
$r = str_replace("[/ol]","</ol>",$r);
$r = str_replace("[quote]","<br /><table width='80%' bgcolor='#ffff66' align='center'><tr><td style='border: 1px dotted black'><font color=black><b>Quote:<br></b>",$r);
$r = str_replace("[/quote]","</font></td></tr></table>",$r);
$r = str_replace("[i]","<i>",$r);
$r = str_replace("[/i]","</i>",$r);
$r = str_replace("[u]","<u>",$r);
$r = str_replace("[/u]","</u>",$r);
$r = str_replace("[spoiler]",'[spoiler]<font bgcolor ="#000000" color="#DDDDDD">',$r);
$r = str_replace("[/spoiler]","</font>[/spoiler]",$r);
$r = preg_replace("/\[size=(.*)\](.*)\[\/size\]/Usi", "<span style=\"font-size:\\1px\">\\2</span>", $r);
$r = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\](.*)\[\/color\]/Usi", "<span style=\"color:\\1\">\\2</span>", $r);
New php-forum User
New php-forum User
Posts: 2
Joined: Sun Feb 03, 2013 9:58 pm

Re: integrating bbcode for youtube in custom forum.

Postby Serifaz » Mon Feb 04, 2013 1:43 pm

New php-forum User
New php-forum User
Posts: 2
Joined: Sun Feb 03, 2013 9:58 pm

Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.