auto embed of [youtube] urls - Joomla! Forum - community, help and support
hi,
i want mambot automatically parse youtune url , replace embed code.
so far have this
i have tried create plugin following nothing happens, not coder , have no idea how debug below
can this?
the idea url http://www.[youtube].com/watch?v=v-c_a_1upm4 automtically gets replaced embed code.
thanks
lee
i want mambot automatically parse youtune url , replace embed code.
so far have this
code: select all
$ret = preg_replace("#(^|[\n ]|<a(.*?)>)http://(www\.)?[youtube]\.com/watch\?v=([a-za-z0-9\-_]+)(</a>)?#im",' <br /><object width="425" height="350"><param name="movie" value="http://www.[youtube].com/v/$4"></param><param name="wmode" value="transparent"></param><embed src="http://www.[youtube].com/v/$4" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />', $ret);
i have tried create plugin following nothing happens, not coder , have no idea how debug below
code: select all
<?php
/** ensure file being included parent file */
defined( '_jexec' ) or die( 'direct access location not allowed.' );
$mainframe->registerevent( 'onpreparecontent', 'tube_content' );
$mainframe->registerevent( 'onpreparecontent', 'googlevideo_content' );
function tube_content( &$row, &$params, $page=0 ) {
$regex = '/\(^|[\n ]|<a(.*?)>)http://(www\.)?[youtube]\.com/watch\?v=([a-za-z0-9\-_]+)(</a>)?/im';
preg_match_all( $regex, $row->text, $matches );
for($x=0; $x<count($matches[0]); $x++)
{
$replace = '<object class="embed" width="425" height="350" type="application/x-shockwave-flash" data="http://www.[youtube].com/v/'.$4.'"><param name="movie" value="http://www.[youtube].com/v/'.$vid.'" /><param name="wmode" value="transparent"><em>you need flashplayer enabled browser view [youtube] video</em></object>';
}
$row->text = str_replace($matches[0][$x], $replace, $row->text);
}
}
?>
can this?
the idea url http://www.[youtube].com/watch?v=v-c_a_1upm4 automtically gets replaced embed code.
thanks
lee
try joomlaworks allvideos plugin.
for example have http://www.[youtube].com/watch?v=v-c_a_1upm4
you can {[youtube]}v-c_a_1upm4{/[youtube]} , [youtube] video
gets embedded automagically.
you can embed others well. can find @ extensions.joomla.org
for example have http://www.[youtube].com/watch?v=v-c_a_1upm4
you can {[youtube]}v-c_a_1upm4{/[youtube]} , [youtube] video
gets embedded automagically.
you can embed others well. can find @ extensions.joomla.org
Comments
Post a Comment