eZ Community » Forums » Setup & design » YouTube Object
expandshrink

YouTube Object

YouTube Object

Tuesday 19 February 2008 9:34:33 pm - 19 replies

I am trying to embed a YouTube object using Custom Tags. Everything goes ok but the object and embed tags gets removed by ez engine;I think. Here is my tpl which is based on the YouTube Plugin

<div class="youtube">
{literal}<object {/literal}width="{$width}" height="{$height}"{literal}>{/literal}{literal}<param name="movie" value="{/literal}{$movie_url}{literal}"></param><param name="wmode" value="transparent"></param><embed src="{/literal}{$movie_url}" type="application/x-shockwave-flash" wmode="transparent" width="{$width}" height="{$height}"{literal}></embed></object>{/literal}
</div>

Here is what my browser gets which is not enough to display the video

<div class="youtube">
<param value="http://www.youtube.com/v/sftTdJrlP7o"></param><param value="transparent"></param>
</div>

What is the problem? I am using eZ 3.9.2

Modified on Tuesday 19 February 2008 9:35:38 pm by OOzy Pal

Tuesday 19 February 2008 10:33:37 pm

hi,

in first, i think You will not use "{literal}" in its true place, in general literal is used when we want to introduce javascrip in language template (to avoid ambiguity between "{" of javascript and "{" of ez)

reference :
http://ez.no/doc/ez_publish/techn...late_functions/miscellaneous/literal

try this code :

<div class="youtube">
      <object width="{$width}" height="{$height}">
              <param name="movie" value="{$movie_url}"></param>
              <param name="wmode" value="transparent"></param>
             <embed src="{$movie_url}" type="application/x-shockwave-flash"   wmode="transparent" width="{$width}" height="{$height}"></embed>
     </object>
</div>

i hope this work.

tks

Abdelkader.

Wednesday 20 February 2008 5:07:52 am

still did not work as the object and embed tags gets removed.

Wednesday 20 February 2008 9:36:10 am

Hello,

I think you have to check settings in settings/override/content.ini.append.php :

[CustomTagSettings]
IsInline[youtube]=true

Wednesday 20 February 2008 12:55:27 pm

I tried it but still no help sad.gif Emoticon.

Wednesday 20 February 2008 1:39:50 pm

I give you my settings :

I create the custom tag "video" :

My content.ini.append.php

<?php /* #?ini charset="utf-8"?
[CustomTagSettings]
AvailableCustomTags[]=video
IsInline[video]=true

[video]
CustomAttributes[]=width
CustomAttributes[]=height
CustomAttributesDefaults[width]=400
CustomAttributesDefaults[height]=316
*/ ?>

design/<site_access>/override/templates/content/datatype/view/ezxmltags/video.tpl

<span class="video">
    <object width="{$width}" height="{$height}" type="application/x-shockwave-flash" data="{$content}">
        <param name="movie" value="{$content}"></param>
        <param name="allowfullscreen" value="true"></param>
    </object>
</span>

Good luck.

Wednesday 20 February 2008 1:50:42 pm

> design/<site_design>/override/templates/content/datatype/view/ezxmltags/video.tpl

This won't work in 4.0, unless its actually a override ( defined in override.ini* ), so needs to be:
design/<site_design>/templates/content/datatype/view/ezxmltags/video.tpl

Or if you use your own design extension:
extension/<my_extension>/design/<site_design>/templates/content/datatype/view/ezxmltags/video.tpl

Modified on Wednesday 20 February 2008 1:51:00 pm by André R

Wednesday 20 February 2008 3:04:31 pm

Mine is in

design/<site_design>/templates/content/datatype/view/ezxmltags/youtube.tpl

and I am running 3.9.2. My original problem is that the tag object and embed get stripped off when the template is parsed. Please see my original post.

Modified on Wednesday 20 February 2008 3:04:42 pm by OOzy Pal

Wednesday 20 February 2008 7:59:01 pm

My solution works from 3.9.3 to 3.4.0:

In content.ini set:

[literal]
AvailableClasses[]
AvailableClasses[]=html

Now create an object with an xml field for example an article, create a literal html block in the xml field by clicking the tab "insert literal text" form OE and choose class>html. Then copy and paste the embed code of your YouTube object in the literal block and publish!
It also works for embedding other objects like google maps etc.

Thursday 21 February 2008 8:20:20 am

Now I have tried to insert a video from You Tube on a 3.9.2 installation, but it doesn't display it, so I think OOzy has to upgrade to 3.9.3, which seems to be the minimum version supporting this function...

Thursday 21 February 2008 9:24:32 am

Hello,

I have upgraded to 3.9.4 and still did not work so I upgraded to 3.10.0 and everything worked ok now.

Thank you all for your help.

OOzy

Monday 10 March 2008 4:48:15 pm

thanks to you <b>Sandra<b/> that is a very easy and realized in seconds solution to embed this objects

so i can report here that this solution is fine working in 4.0.x also

lorbas

Thursday 28 August 2008 11:16:17 pm

Same problem here in ez 4.0.0 with both the custom tags and the object html tag in the ezxml custom tag template.

I've tried, too, the solution from Sandra using the 'literal' ezxml tag and the 'html' class, to no avail, even if the default template does actually detect the classification

---------
1 content/datatype/view/ezxmltags/literal.tpl <No override> design/standard/templates/content/datatype/view/ezxmltags/literal.tpl
---------
(native) template code :

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{section show=ne( $classification, 'html' )}
<pre{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content|wash(xhtml)}</pre>
{section-else}
{$content}
{/section}

I really do think that something is messed up, somehow, maybe a "collision" between the 'object' ezxml tag and the 'object' html tag in the content/datatype/view/ezxmltags template, be it the 'literal' tag template or a 'custom' tag template.

Thursday 28 August 2008 11:33:24 pm

Some additional info : when in the 'literal' tag template, the tag value is unaltered.

Given the following template code :

{section show=ne( $classification, 'html' )}
	<h1>this is not html</h1>
	<pre{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content|wash(xhtml)}</pre>
{section-else}
	<h1>this is html</h1>
	{$content}
{/section}
<h1>{$classification}</h1>
<pre>{$content|wash()}</pre>

and the following 'literal' tag value :

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/-XzNIUt1dBQ&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/-XzNIUt1dBQ&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>

Here's the output :

<h1>this is html</h1>
<param value="http://www.youtube.com/v/-XzNIUt1dBQ&hl=en&fs=1"></param><param value="true"></param>

<h1>html</h1>
<pre>&lt;object width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/-XzNIUt1dBQ&amp;hl=en&amp;fs=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/-XzNIUt1dBQ&amp;hl=en&amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;/embed&gt;&lt;/object&gt;
</pre>

So :
1) the $content DOES contain the plain value of the 'literal' tag
2) the 'html' $classification value IS there

I've performed an additional test, using the set-block operator to output the value of $content in a template variable, then display it in a <pre> tag :

<h2>Using set-block</h2>
{set-block variable=grabcontent}
	{$content}
{/set-block}
<pre>{$grabcontent}</pre>

The result is the same, the 'object' and 'embed' HTML tags just vanished :

<h2>Using set-block</h2><pre><param value="http://www.youtube.com/v/-XzNIUt1dBQ&hl=en&fs=1"></param><param value="true"></param>
</pre

Friday 29 August 2008 1:47:00 pm

For all people having this kind of problem of the <object> and <embed> html tags disappearing, try to look for ANY template override or redefinition of content/datatype/view/ezxmltext.tpl for instance in your design extensions.

If you're using the xmlwash operator / extension, don't look further, it's the culprit.
This extension redefines the ezxmltext.tpl :

{if is_set($maxlength)}
{$attribute.content.output.output_text|shorten($maxlength)|xmlwash()}
{else}
{$attribute.content.output.output_text|xmlwash()}
{/if}

While it does its job to close unproperly closed html tags, it also delete the following html tags :

 var $deleteTags = array(
  'applet', 'base',   'basefont', 'bgsound', 'blink',  'body', 
  'embed',  'frame',  'frameset', 'head', 'html',   'ilayer', 
  'iframe', 'layer',  'link',  'meta', 'object', 'style', 
  'title',  'script', 
  );

while not clearly claiming it in the documentation ...

Wednesday 29 October 2008 6:46:16 pm

Hi

Just an update on the solution using Literal Tags, which is great and I have used it for all sorts. But I recently discovered that it does not seem to work using the Online editor and IE7. If the code you cut and paste from YouTube, Google etc contains a "http://..." which it invariably does, ie in the online editor highlights this as a link and when you publish it there are extra <A> </A> tags around all your file references and so doesn't work.

Thursday 30 October 2008 8:41:22 am

Hi Richard,
it would be great if you post your message also here:
http://ez.no/developer/contribs/applications/ez_oe_mce

I think it's an issue that must be fixed before final release of OE 5

Thanks!

Tuesday 13 January 2009 5:21:09 am

Hi,

I read the articles and know that there is a solution for 3.9 and above.

Does anyone has any idea if there is any solution to add YouTube Object for 3.8?

Thanks!

Saturday 24 January 2009 1:06:13 am

Have you had a look at

http://ez.no/developer/contribs/template_plugins/youtube_template_plugin

I used to use this on 3.6.x and it was fine. It is documented to work on 3.9 and from how it works I don't see why it should not work on 3.8

Friday 29 October 2010 4:21:49 pm

If you're using the xmlwash operator / extension, don't look further, it's the culprit.

That was it for me. The code thats washing out <embed> and <object> (but not "param"blunk.gif Emoticon is in extension/xmlwash/safehtml/safehtml.php at the top. it's also stripping all attributes with the name "name" (in the $attributes array). remove these and at least youtube will work again.

thanks!

*-pike

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from