Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • stc 72 posts 101 karma points
    May 06, 2010 @ 13:13
    stc
    0

    Can I Get Media Path from node field which is of MediaPicker datatype?!

    Is there a way to call a macro inside a template which contains umbraco.library calls as parameters:

    <umbraco:Macro VideoURL="[#videoObject]" Width="640" Height="320" ThumbnailImage="[#thumbnailObject]" Alias="UmbracoVideo" runat="server"></umbraco:Macro>

    I've added a Video DocumentType and added two properties to it ("url" and "thumbnail") both of those two are media picker data types (pointing/picking out a Video and an Image MediaType respectively). The umbraco macro call above inside of the template returns the respected MediaType object node IDs insetad of friendly path to those which I should probably get with something like this

    umbraco.library:GetMedia($currentPage/data [@alias = 'Video'], 'false')/data [@alias = 'umbracoFile'] instead of just [#videoObject]

    What is the best practice for getting media to display...building separate XSLTs that will return appropriate HTML markup...how do you separate your media, how do you bind it to your articles, please share some experiences...TIA

  • Chris Dunn 210 posts 401 karma points
    May 06, 2010 @ 21:59
    Chris Dunn
    0

    If the macro is only intended to display data for your  "Video DocumentType", I wouldn't bother passing each parameters and just let the macro use the "currentPage" parameter to pull out the videoObject and thumbObject from within the xslt.  Otherwise passing the page properties as params is a good way to go.  Either way let the macro xslt figure out the media path.

    For simplicity sake I would try to put as much of the logic in the macro xslt instead of a blend of macro and the template.  I generally try to design my macros as plugins which contain all the code for that feature (including html), whether that's a menu or video display.

    IMO:)

    -Chris

     

     

Please Sign in or register to post replies

Write your reply to:

Draft