All pastes #608834 Raw Edit

Someone

public php v1 · immutable
·published 2007-07-08 15:02 UTC
rendered paste body
Hi,  PROBLEM: I am trying to add youtube embed on my site. The followings string recognizes the syntax:   [youtube=height,widht,id_url]url_without_id_url[/youtube] AIM: I would like to change it so that the syntax changes to    [youtube]url_with_id_url[/youtube]// [youtube] and [/youtube]$text = preg_replace("#\[youtube=([0-9]+)[,]([0-9]+)[,]([0-9a-z\-_]+):$uid\](.*?)\[/youtube:$uid\]#si", "<object width=\"\\1\" height=\"\\2\"><param name=\"movie\" value=\"http://www.youtube.com/v/\\3\"></param><embed src=\"http://www.youtube.com/v/\\3\" type=\"application/x-shockwave-flash\" width=\"\\1\" height=\"\\2\"></embed></object>"."[/youtube:$uid]", $text);	$text = str_replace("[/youtube:$uid]", "", $text); 		// [youtube]url[/youtube]$pattern = "/\[youtube:$uid\](.*?)\[\/youtube:$uid\]/si";$replacement = "<object><param name=\"movie\" value=\"$1\"></param><embed src=\"$1\" type=\"application/x-shockwave-flash\"></embed></object>";$text = preg_replace($pattern, $replacement, $text);;