Copied to clipboard

Flag this post as spam?

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


  • asim 16 posts 36 karma points
    Apr 27, 2011 @ 15:46
    asim
    0

    Allowing an option in Doc type media picker to be displayed in Child pages

    Is there any possible way to Allow an option in Doc type media picker to be displayed in Child pages

    by using a tick box next to browse images.

     

  • Rich Green 2246 posts 4008 karma points
    Apr 27, 2011 @ 15:53
    Rich Green
    0

    Hi,

    Not sure I understand your question correctly but what I'd do is to have the same content picker on all doc types below, if the user doesn't select a doc type then in your XSLT / razor simply use the medida picked above (until you find one where a user has made a selection).

    Rich 

  • asim 16 posts 36 karma points
    Apr 27, 2011 @ 21:17
    asim
    0

    thanx Rich

    your solution seems to be convincing, but could you guide a little bit how can i use my XSLT for media picked in parent node.

    (actuallly i am new to xslt and umbraco, so sorry for such a simple task)

    Asim

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 27, 2011 @ 23:47
    Jan Skovgaard
    0

    Hi Asim

    I suppose the above screendump is a mashup of what you want to do - place the checkbox net to the picker?

    That's not possible - you need to create a property beneath the picker and then check if the property has been checked to decide whether or not the image should be inherited to subpages.

    Hope this makes sense to you?

    /Jan

  • Rich Green 2246 posts 4008 karma points
    Apr 27, 2011 @ 23:50
    Rich Green
    0

    Hey Asim,

    Do all your media pickers have the same name & what version of umbraco are you using,

    Let me know and I'll try to post some xslt.

    Rich

  • asim 16 posts 36 karma points
    Apr 28, 2011 @ 07:44
    asim
    0

    Hi Rich

    i am using Umbraco 4.7 and yes all media pickers are same for a particular section of pages who are inherited from that Doc type..

    and is it possible if i user select the image from parent page and dont choose any images from child pages, so all the child pages gets the same image as the parent.

    thanks

    Asim

  • asim 16 posts 36 karma points
    Apr 28, 2011 @ 09:49
    asim
    0

    Hi Jan

    thats what i did as you told, i had made a true/false property below media picker in doc type.

    plz tel me how to modify the XSLT for allowing the image to be displayed in child pages

    Thanks

    Asim

  • Rich Green 2246 posts 4008 karma points
    Apr 28, 2011 @ 10:10
    Rich Green
    0

    Hey Asim,

    Sorry, was sleeping :)

    Taking from this post here http://our.umbraco.org/forum/developers/xslt/11470-Recursive-macro-for-a-banner?p=1

    Set up a macro parameter named myMacroPropertyAlias

    Then in your template where you want your image to show insert your macro

    <umbraco:macro alias="myMacro" myMacroPropertyAlias="[$bannerImage]" />

    In the above line bannerImage is the name of your property 

    The $ notation tells umbraco to look up the tree until it finds a value for bannerImage

    Then add the following lines to your XSLT file, one to retrieve the parameter, the other to display the image (tweak however you need to)

    <xsl:variable name="myProp" select="/macro/myMacroPropertyAlias" />
    
    <xsl:value-of select="umbraco.library:GetMedia($myProp, '0')/umbracoFile"/>

    Hope that helps


    Rich

  • asim 16 posts 36 karma points
    Apr 28, 2011 @ 13:34
    asim
    0

    Hi Rich, how are you

    i saw this functionality in this post, which is what i want to do, here:

    http://forum.umbraco.org/yaf_postst6234_Getting-media-based-on-parent-folder.aspx

    but this isnt working for me, i guess i m using v4.7 it might have different syntax, kindly help me for this, here is  my xslt

     

    <xsl:if test="$currentPage/ancestor-or-self::node [string(data[@alias='bannerImage_nl'])]/data [@alias = 'bannerImage_nl'] != ''">
          <xsl:element name="img">
            <xsl:attribute name="src"><xsl:value-of select="umbraco.library:GetMedia($currentPage/ancestor-or-self::node [string(data[@alias='bannerImage_nl'])]/data [@alias = 'bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/></xsl:attribute>
            <xsl:attribute name="alt"><xsl:value-of select="$currentPage/data [@alias = 'DisplayName']"/></xsl:attribute>
          </xsl:element>
      </xsl:if>

  • Rich Green 2246 posts 4008 karma points
    Apr 28, 2011 @ 13:39
    Rich Green
    0

    Hi, 

    This code above wont work for 4.7, did you try my suggestion? They both do the same thing but in a slightly different way.


    Rich

  • Pasang Tamang 258 posts 458 karma points
    Apr 28, 2011 @ 13:43
    Pasang Tamang
    0

    Hi asim

    Please have a look on this http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema. Here you can find the xslt changes for umbraco v4.5 or later version.

    Thanks

    Pnima

  • asim 16 posts 36 karma points
    Apr 28, 2011 @ 14:43
    asim
    0

    Thanks Pnima,

    Hi Rich i tried ur solution, but didnt worked for me,

    i wana use this,

            <xsl:attribute name="src"><xsl:value-of select="umbraco.library:GetMedia($currentPage/ancestor-or-self::node [string(data[@alias='bannerImage_nl'])]/data  [@alias = 'bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/>

    </xsl:attribute>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 28, 2011 @ 16:43
    Jan Skovgaard
    0

    Hi Asim

    What error message do you get?

    And do you get the error inside the XSLT editor in Umbraco or on the website?

    /Jan

  • asim 16 posts 36 karma points
    Apr 28, 2011 @ 21:54
    asim
    0

    Hi Jan

    i didnt get any errors, xslt is saved without errors,

    but nothing is shown in browser when i use this for code for my xslt

    <xsl:attribute name="src">

    <xsl:value-of select="umbraco.library:GetMedia($currentPage/ancestor-or-self::node [string(data[@alias='bannerImage_nl'])]/data  [@alias = 'bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/>

    </xsl:attribute>


    but it works fine for this one

    <xsl:attribute name="src">

    <xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/>

    </xsl:attribute>


    any help would be highly appreciated.

    Asim

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 28, 2011 @ 22:21
    Jan Skovgaard
    0

    Hi Asim

    I just noticed you have written that you are using version 4.7 of Umbraco and that is why the above code does not return anything and why it does not fail since the syntax is correct but the elements it's trying to match in the XML file just does not exists, since it's trying to match the XML syntax from the old legacy schema.

    You can read more about the differences in the schemas here: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema and you can probably benefit from this converter created by Tommy Poulsen here: http://blackpoint.dk/umbraco-workbench/tools/convert-xml-schema-to-45-.aspx

    I'm a bit puzzled that you write this code works...

    <xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/>

    It's seems to me that it is a mixture of the new and old xml schema?

    This looks right to me

    <xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='bannerImage_nl'], 0)/umbracoFile"/>

    Does this work for you?

    /Jan

  • asim 16 posts 36 karma points
    Apr 28, 2011 @ 23:55
    asim
    0

    Hey Jan, how are you

    you know your code converter site works like a magic for me,  u were rite it was a mixture of old schema and new one.

    thanks a lot

    Asim

Please Sign in or register to post replies

Write your reply to:

Draft