i want to make a macro (with xsl) which show a video (top of the page) and next a list of videos but only video description, image, and a link. so when i click the link show the video in the top of my page.
i already have the list of videos, and can show a video, but how can i send the id or path of my video from the link clicked?
There are two ways I'd say you could do this, with and without javascript.
1) Use Javascript if you want to load the new video without a page refresh. Just use javascript to grab the video id from the clicked video link (either in the href or a data- attribute) and dynamically load the video into the section at the top of the page.
2) If you want a page refresh to happen everytime you click a video link, you could put the id of the video in a request parameter in url. The video link would look something like /videopage.aspx?YouTubeID=dIYvD9DI1ZA (if using YouTube). In your Macro XSLT check if there's a video request parameter using umbraco.library:RequestQueryString('YouTubeId') and then using the id load the relevant video at the top of the page. If there's no request parameter just load the first video in the list.
i've never used InsertVideo or Flowplayer so can't comment on the details but hopefully I can point you in the right direction.
Making your playlist you could maybe use something like this:
<ul> <!-- Iterate over your list of video nodes --> <xsl:for-each select="VideoList"> <!-- Save each video item --> <xsl:variable name="video" select="umbraco.library:GetMedia(., 0)" />
<li> <!-- Create a href to your video file using the saved media item --> <a href="{$video/umbracoFile}"> <xsl:value-of select="$video/@nodeName"/> </a> </li> </xsl:for-each> </ul>
You would then use Javascript to hijack the click event on the link, grab the value of the href for that link and then reload your video at the top of the page. You'd have to look at the flowplayer api to see how to reload videos.
where $firstVidea has the id of my video and it always has a value (correct value), i have a validation if IdVideo from QueryString is empty set the value from the first idVideo in my list.
so my question now is... how call a macro from xsl?
Saying that you should be able to call your InsertVideo template from your XSLT without having to call the macro. Is your include path correct? Maybe as a test, copy the InsertVideo template to your XSLT. This way you can determine whether the InsertVideo template is working correctly and if it is a path issue or something else.
Warning, Umbraco 4 macros with new templates have a different syntax however the XSLT extention still requires the old v3 one so if you copy the macro inserted into a v 4 template you need to change it to v3
Show Video from a link clicked in a list
Hi everyone!
i hope you can help me in this....
i want to make a macro (with xsl) which show a video (top of the page) and next a list of videos but only video description, image, and a link. so when i click the link show the video in the top of my page.
i already have the list of videos, and can show a video, but how can i send the id or path of my video from the link clicked?
any suggestions?
Regards...
by the way im using umbraco 4.7
There are two ways I'd say you could do this, with and without javascript.
1) Use Javascript if you want to load the new video without a page refresh. Just use javascript to grab the video id from the clicked video link (either in the href or a data- attribute) and dynamically load the video into the section at the top of the page.
2) If you want a page refresh to happen everytime you click a video link, you could put the id of the video in a request parameter in url. The video link would look something like /videopage.aspx?YouTubeID=dIYvD9DI1ZA (if using YouTube). In your Macro XSLT check if there's a video request parameter using umbraco.library:RequestQueryString('YouTubeId') and then using the id load the relevant video at the top of the page. If there's no request parameter just load the first video in the list.
Hope that helps,
Pat
Hi Pat Thanks for Replay
i like to do this with the first option, i don´t using YouTobe, im taking the videos from media folder with package InsertVideo 1.1,
im new in Umbraco so i don´t know how to save the videoid in xsl with javascript, i supose that de script have to be in my xsl
i´ll lookin for example in the forum,
but if you have some code sniped, i´ll thank you.. again
Cristian
Hey Cristian,
i've never used InsertVideo or Flowplayer so can't comment on the details but hopefully I can point you in the right direction.
Making your playlist you could maybe use something like this:
<ul>
<!-- Iterate over your list of video nodes -->
<xsl:for-each select="VideoList">
<!-- Save each video item -->
<xsl:variable name="video" select="umbraco.library:GetMedia(., 0)" />
<li>
<!-- Create a href to your video file using the saved media item -->
<a href="{$video/umbracoFile}">
<xsl:value-of select="$video/@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
You would then use Javascript to hijack the click event on the link, grab the value of the href for that link and then reload your video at the top of the page. You'd have to look at the flowplayer api to see how to reload videos.
Pat :-)
thanks a lot Pat,
at the end i do it makin the url, sending the id video with querystring.
works fine, but now my problem is to load the video the first time when the page load,
i don´t know how to set default value or load the video with de first item of the list...
i tried incluying the xslt file of insertVideo in my xsl:
<xsl:include href="InsertVideo.xslt"/>
and calling the template, but don´t work
<xsl:call-template name="InsertVideo">
<xsl:with-param name="videonode" select="$firstVideo" />
<xsl:with-param name="videowidth" select="450" />
<xsl:with-param name="videoheight" select="322" />
xsl:call-template>
where $firstVidea has the id of my video and it always has a value (correct value), i have a validation if IdVideo from QueryString is empty set the value from the first idVideo in my list.
so my question now is... how call a macro from xsl?
Hey,
I haven't tried calling a macro from an XSLT for a while but have a look at this thread here. There seems to be a solution here
http://our.umbraco.org/forum/developers/xslt/10527-Call-Macro-within-a-XSLT
Saying that you should be able to call your InsertVideo template from your XSLT without having to call the macro. Is your include path correct? Maybe as a test, copy the InsertVideo template to your XSLT. This way you can determine whether the InsertVideo template is working correctly and if it is a path issue or something else.
Hope that helps,
Pat
Ok, i allready have seen that but i dont undertood in that moment.. jejej
i aplied that solution but still with any good result. that solution is with Umbraco v3,
i change the declaration of umbraco macro tags from this:
<xsl:text><?UMBRACO_MACRO macroAlias="InsertVideo" videoNode="</xsl:text>
to this:
<xsl:text><umbraco:Macro Alias="InsertVideo" videoNode="</xsl:text>
i tryed to with:
<xsl:value-of select="umbraco.library:RenderMacroContent(concat('<UMBRACO_MACRO macroAlias="InsertVideo" videoNode="', $firstVideo, '" VideoWidth="411" VideoHeight="241"></?UMBRACO_MACRO>'), $currentPage/@id)" disable-output-escaping="yes"/>
and
<xsl:value-of select="umbraco.library:RenderMacroContent(concat('<umbraco:Macro Alias="InsertVideo" videoNode="', $firstVideo, '" VideoWidth="411" VideoHeight="241"></?umbraco:Macro>'), $currentPage/@id)" disable-output-escaping="yes"/>
i copied the string generate in my templete and work fine, but in xsl i get nothing.
Regarts
but i think that is another topic, so thanks a lot for you help, i take your response as good!
Last try :-)
have a look at this page http://our.umbraco.org/wiki/reference/umbracolibrary/rendermacrocontent
Specifically the last section:
Version 4 Warning
Warning, Umbraco 4 macros with new templates have a different syntax however the XSLT extention still requires the old v3 one so if you copy the macro inserted into a v 4 template you need to change it to v3
i.e.
<umbraco:Macro Alias="Name" runat="server"></umbraco:Macro>
becomes
<?UMBRACO_MACRO macroAlias="Name" runat="server"></?UMBRACO_MACRO>
(with escaping)
Excelent!!!!!!! it works!!
my mistake... was dont put '?' in the begining of UMBRACO_MACRO
concat('<UMBRACO_MACRO macroAlias
concat('<?UMBRACO_MACRO macroAlias
Thanks Alot Pat
is working on a reply...