|
|
Rank: Devotee
Joined: 12/11/2006 Posts: 47
|
Hi I am currently having some trouble, figuring out how to embed videos from youtube in umbraco. I want to be able to embed the videos through a macro I have created, so I can embed the video with my text content. I have chosen the datatype to be text, for the HTML code provided by youtube to embed the video. But when I insert the text and click "ok", the video is appearing in the content followed by this text/code: "ismacro="true" onresizestart="return false;" umbVersionId="8efd9e8a-0aa5-47cc-beef-fc6cdbd221da" umbPageid="1502" title="This is rendered content from a macro" contentEditable="false" class="umbMacroHolder" ondblclick="umbracoEditMacro(this);">No macro content available for WYSIWYG editingIf I click "Save and publish", a .NET error occurs in the CMS and I cannot edit the content anymore. Then I have to delete the page and start all over. I am aware that the text datatype might be the problem, but I cannot figure out how else it should be done, when I want to be able to do it through a macro - any ideas? The code for my XSLT is as shown below. Code:<xsl:variable name="videoSti" select="/macro/videoInsert"/>
<xsl:template match="/"> <!-- start writing XSLT -->
<xsl:value-of select="$videoSti" />
</xsl:template> I am running version 2.1.7 of the system. Cheers!
/Jan
|
|
Rank: Enthusiast
Joined: 8/2/2006 Posts: 30
|
Hi Jan, You just need to tweak your XSLT to disable output escaping: Code:<xsl:value-of select="$videoSti" disable-output-escaping="yes"/> Regards, Michael
|
|
Rank: Devotee
Joined: 12/11/2006 Posts: 47
|
Hi Michael,
I have tweaked my XSLT file as you have suggested, but it does'nt seem to solve the problem.
After I tweaked the code I tried to embed the video again and the same text/code appears.
I am having a hard time understanding this...:(
Cheers
/Jan
|
|
Rank: Enthusiast
Joined: 8/2/2006 Posts: 30
|
Can you paste an example of the youtube code that breaks your page? I've created a macro with a single text input field, which can be used in the editor, and created an xslt idenitcal to yours and it works fine.
|
|
Rank: Devotee
Joined: 12/11/2006 Posts: 47
|
Hi Michael
It is in the editor, that the text/code comes. Not in the frontend.
The code I'm trying to write to the HTML that the system generates is:
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/5ZKKnOtJ9Wg"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/5ZKKnOtJ9Wg" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
Which inserts the video from youtube.
It seems to me, that when an element has an attribute, this text appears in the editor next to the embedded video:
"ismacro="true" onresizestart="return false;" umbVersionId="8efd9e8a-0aa5-47cc-beef-fc6cdbd221da" umbPageid="1502" title="This is rendered content from a macro" contentEditable="false" class="umbMacroHolder" ondblclick="umbracoEditMacro(this);">No macro content available for WYSIWYG editing
I am sorry if I have not expressed myself good enough earlier :)
Cheers
/Jan
|
|
Rank: Enthusiast
Joined: 8/2/2006 Posts: 30
|
Hi Jan, I just realised I'd testing it in a v3 site. Going back to 2.1.7 I get the same error. It is because the HTML that is added in the HTML editor control does not escape any html characters. I can see from the YouTube site that the only thing that changes in the code is the url to the video. A solution would be to modiy the xslt to read as below: Code:<xsl:variable name="videoSti" select="/macro/videoInsert"/>
<xsl:template match="/"> <!-- start writing XSLT -->
<object width="425" height="350"><param name="movie"><xsl:attribute name="value"><xsl:value-of select="$videoSti" /></xsl:attribute></param><param name="wmode" value="transparent"></param><embed type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"><xsl:attribute name="src"><xsl:value-of select="$videoSti" /></xsl:attribute></embed></object>
</xsl:template> Then simply paste the url contained in the YouTube embed code (e.g. http://www.youtube.com/v/aEc8v1OWeE4). Or you could upgrade to v3 :D Regards, Michael
|
|
Rank: Devotee
Joined: 12/11/2006 Posts: 47
|
Hi Michael,
Thank you very much for your help! :) I should have thought of that solution myself!. But sometimes one is just blinded by the obvious.
But once again, thank you for taking your time to help me out :)
Cheers
/Jan
|
|
Rank: Newbie
Joined: 9/27/2007 Posts: 1
|
Michael,
I'm trying to follow this thread, but I'm not able to get it all working. I am using V3, what are the steps I need to follow to get YouTube-movies on my screen?!
Hope you want to help me!
|
|
 Rank: Devotee
Joined: 9/8/2006 Posts: 88 Location: Northern California
|
This is what I did to get this to work. 1) Created XSLT file with this code. Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<!-- Input the documenttype you want here --> <xsl:variable name="videoSti" select="/macro/videoSti"/>
<xsl:template match="/"> <!-- start writing XSLT -->
<object width="425" height="350"><param name="movie"><xsl:attribute name="value"><xsl:value-of select="$videoSti" /></xsl:attribute></param><param name="wmode" value="transparent"></param><embed type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"><xsl:attribute name="src"><xsl:value-of select="$videoSti" disable-output-escaping="yes"/></xsl:attribute></embed></object>
</xsl:template>
</xsl:stylesheet> 2) Created a macro called YouTube and added one paramater with alias of "videoSti" that was a text string. 3) on the content page put curser to where I wanted the video to appear and then I clicked the macro button and choose YouTube and entered only the link info of the url including http but nothing else.
|
|
Rank: Devotee
Joined: 11/16/2007 Posts: 51
|
I tried this and found that the YouTube video did not appear (don't know why?!). I simplified it to this: Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<!-- Input the documenttype you want here --> <xsl:variable name="videoSti" select="/macro/videoSti"/>
<xsl:template match="/"> <!-- start writing XSLT -->
<xsl:value-of select="$videoSti" disable-output-escaping="yes"/> </xsl:template>
</xsl:stylesheet> and use the parameter (videoSti) to paste in the full "embed" link provided by YouTube. Doing it this way means you can also take advantage of the "customise" function on YouTube.
Gordon Saxby | Ascend Internet Limited | Web Site Development, Hosting & Domain Names
|
|
 Rank: Aficionado
Joined: 12/15/2006 Posts: 112
|
I tried both these methods but kept getting a .NET error:
Length cannot be less than zero. Parameter name: length
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +2916097 umbraco.editorControls.tinymce.TinyMCE.generateMacroTag(String macroContent) +86 umbraco.editorControls.tinymce.TinyMCE.replaceMacroTags(String text) +203 umbraco.editorControls.tinymce.TinyMCE.Save() +67
Any ideas? (using v3.0.5)
___________________________________________________________________________________
Neil
|
|
 Rank: Fanatic
Joined: 9/27/2007 Posts: 465 Location: Belgium
|
Hi all, Tim has also posted about embedding a youtube movie. Have a look here. Hope that helps. Regards. /Dirk
level 1 certified - umbraco blog at netaddicts.be
|
|
|
Guest |