Page 1 of 1

you tube codes stopped working

Posted: Mon Jan 31, 2011 12:00 pm
by ozdecor
hello We had you tube videos in pages, now we find that when we edit them the code vanishes
have tried the {literal} {/literal} around the code without success. What is the best way to embedd a youtude video in a page

IAn

Re: you tube codes stopped working

Posted: Mon Jan 31, 2011 12:03 pm
by M@rtijn
There is a Youtube Module: http://dev.cmsmadesimple.org/project/fi ... ackage-865

Worked like a charm on one of my projects

Re: you tube codes stopped working

Posted: Mon Jan 31, 2011 12:15 pm
by ozdecor
looked at that but it does not show on the page editor
Call ? but when the help says
To call the module, simply use the following tag:
{cms_module module="youtubeplayer"} or {cms_module module="youtubeplayer" alias="alias_of_item"}? Tried them in the page code (both sides of the wysiwyg editor)

where do i actually use that code?

and why has the youtube iframe code stopped working? - i could do it as a global block butthat is a bit of a overkill (or is it the only way)?
Ian

Re: you tube codes stopped working

Posted: Mon Jan 31, 2011 3:23 pm
by Jeff
I turn off the wysiwyg editor (disable checkbox is halfway down on the options tab) for pages with embed code or js because TinyMCE will filter it when you save it.

Re: you tube codes stopped working

Posted: Mon Jan 31, 2011 11:45 pm
by ozdecor
Is there a better way as when you have other content in the page it will look poor if the page creater does not know code (which most don't) - is the alternative globalblocks?
Ian

Re: you tube codes stopped working

Posted: Tue Feb 01, 2011 12:29 am
by Dr.CSS
Tiny eats code like that, best to put it in GCB then call that in page content edit box...

Re: you tube codes stopped working

Posted: Tue Feb 01, 2011 2:08 pm
by scooper
I have a simple user defined tag (UDT) I use. It's pretty basic but works for me.

Create a UDT called 'youTube' with the following code:

Code: Select all


// write out an embed tag for a youtube vid.

$ytCode=$params['code'];

if(isset($params['height'])){
	$height=$params['height'];
}else{
	$height=385;
}

if(isset($params['width'])){
	$width=$params['width'];
}else{
	$width=640;
}

if(isset($params['autoplay'])){
	$autoplay=$params['autoplay'];
}else{
	$autoplay=0;
}


$vidString='<div>';
$vidString.='<object width="'.$width.'" height="'. $height .'">';
$vidString.='<param name="movie" value="http://www.youtube.com/v/' . $ytCode .'&hl=en_GB&fs=1&rel=0&autoplay=' . $autoplay . '"></param>';
$vidString.='<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="opaque"></param>';
$vidString.='<embed src="http://www.youtube.com/v/' . $ytCode .'&hl=en_GB&fs=1&rel=0&autoplay=' . $autoplay .'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="' . $width .'" height="' . $height .'"></embed></object>';
$vidString.='</div>';

echo $vidString;

And then in your page content you can then add a tag in the form:

Code: Select all

{youTube code="H4O8_InlyYs"}
where 'code' is the id of your video. You can also pass height, width and autoplay parameters.

Hope it helps.

s.