How do I allow users to embed videos into my site? They will input the code on one page and the video will show on another page, how do i do this please help me thank you
Hi, I looked but i don't understand any on it, I was hoping some could tell what codes i got to use and where i put them.
sorry about that. even bb_code_create() not available on my machine. php 5.2.3 windows. i give it a try.
<?php if (!empty($_POST['video_id']) ){ $video_id = $_POST['video_id']; $pattern = '#\[youtube\](.+?)\[/youtube\]#'; $convert_to_this = '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/\1?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/\1?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>'; $user_enter_this = "[youtube]".$video_id."[/youtube]"; $result = preg_replace($pattern, $convert_to_this, $user_enter_this); echo $result; } ?> <?php if (empty($_POST['video_id']) ): ?> <form method="post" action=""> <input type="text" name="video_id" /> <input type="submit" /> </form> <?php endif; ?> Code (markup): 1. user enter [youtube]video_id[/youtube] example: [youtube]yvuOtlpSAeY[/youtube] 2. then it will be converted to embed video tag 3. then you can add this on your wysiwyg editor