Jump to content

Custom Forum Youtube integraton.


Recommended Posts

Hello I have been working on developing a custom forum software for personal use.

I have everything done accept for the youtube integratio the align and link features in the post.


As of right now Im more concerned with the youtube integration.

I am currently using js to add the button and tags to the post and php to implement what the tags do.


Currently the button is fine it posts the youtube tags which are [vid][/vid]


I am just having trouble figuring out how to assing a variable so that a user can input the video id.

I am trying to replace {PARAM} with the video id.


here is what I have on the php file.


$r = str_replace("[vid]","<object width='425' height='344'><param name='movie' value='http://www.youtube.com/v/{PARAM}'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/{PARAM}' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='344'></embed></object>",$r);
$r = str_replace("[/vid]","",$r);
$r = str_replace("{PARAM}", "KcuJAe3TrQw",$r);


I have put a video id of KcuJAe3TrQw in quotes to see if the youtube will get put in if I just use the tags and it indeed does.

What I want to do is replace the id with a variable that I can let the user asign the id to...

How would I do this or something relevant that would work.


Also if you have any spare time I would love to know what I am doing wrong with the align


$r = str_replace("
$r = str_replace("[/center]


Thanx for looking at my post and I hope you can help me :)

Link to comment
Share on other sites

The ID could be entered into the [vid] tag...similar to the BBCode for links (http://www.bbcode.org/examples/?id=9).




The ID could be pulled from the tag and used for the string replace function.



As for your other question, shouldn't the open center tag (

) be replaced with an open HTML tag? The close tag would be replaced with the corresponding HTML close tag. For example


$r = "[center]Center this[/center]
$r = str_replace("
[center]","<div align='center'>",$r);
$r = str_replace("[/center]
print $r;

Link to comment
Share on other sites

Hey sorry I am having trouble understanding.

How exactly do I use the tags to let the user specify the youtube id.

I get that I can make the tags work like



but how do I make it so that in the code I gave the vid tag will not need to be set to just one video.

Sorry Im not very experienced with bbcode. can you give me an example of how I would use the {PARAM} to let the user assign what is in that part of the url?

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.