http://cyberslug.net
to activate in your template, add this tag:
immediately prior to the tag that reads:
now you can embed youtube videos or
playlists into the text of your post
using these tags:
video-idplaylist-id
(http://www.youtube.com/watch?v=video-id)
(http://www.youtube.com/view_play_list?p=playlist-id)
multiple videos ok, each on a seperate line
******************************************/
function embed_youtube ($content) {
global $postings, $currentid;
$tags = array();
$x = $postings[$currentid]['message_html'];
// quick-n-dirty SGML parser in 5 lines!
foreach(explode("\n", $x) as $key => $value) {
unset($m);
ereg("[^<]+", $value, $m);
if(isset($m[0])) {
$tags[$m[0]] = ereg_replace("<[\/]?yt(p)?>", "", $m[0]);
}
}
foreach($tags as $key => $id) {
if(ereg("", $key)) {
$y = "";
$x = str_replace("".$id."", $y, $x);
} else {
$y = "";
$x = str_replace("".$id."", $y, $x);
}
}
$postings[$currentid]['message_html'] = $x;
return "";
}
?>