ninexn
03-16-2009, 11:49 PM
I currently have a script that inserts a video play on my blog, it looks for [video=11] 11 being the video id.
I want to be able to have video variables, such as:
[video=11&w=600&h=333]
and then have each variable $filename, $width, $height.
Any ideas?
This is the code i am using.
add_filter('the_content', 'ninexn_the_content');
function ninexn_the_content( $content )
{
// find video id
$search = "/\[video=(.*)\]/";
preg_match_all($search, $content, $video_matches);
if (is_array($video_matches[1]))
{
foreach ($video_matches[1] as $filename)
{
$search = "[video=".$filename."]";
$replace = ninexnvideo($filename);
$content = str_replace ($search, $replace, $content);
}
}
return $content;
}
I want to be able to have video variables, such as:
[video=11&w=600&h=333]
and then have each variable $filename, $width, $height.
Any ideas?
This is the code i am using.
add_filter('the_content', 'ninexn_the_content');
function ninexn_the_content( $content )
{
// find video id
$search = "/\[video=(.*)\]/";
preg_match_all($search, $content, $video_matches);
if (is_array($video_matches[1]))
{
foreach ($video_matches[1] as $filename)
{
$search = "[video=".$filename."]";
$replace = ninexnvideo($filename);
$content = str_replace ($search, $replace, $content);
}
}
return $content;
}