Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 09:18
    dominik
    0

    get document property into macro

    I cant get the property of a document type into my macro

    i got the following line inside my template file:

      <umbraco:Macro Alias="BannerTool" position="[#bannerPosition]" runat="server"></umbraco:Macro>

    But it looks like the property "bannerPosition" is not parsed to the xslt. If i use a fix value instead it is parsed. I also looked if the property is named correctly.

    Anybody any idea?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 22, 2011 @ 10:54
    Jan Skovgaard
    0

    Hi Dominik

    What does your XSLT for this look like?

    /Jan

  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 11:07
    dominik
    0
    <xsl:variable name="pos" select="/macro/position"/>

    And i get the value via :

    <xsl:value-of select="$pos"/>
  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 11:36
    dominik
    0

    What I have forgot to mention the property is a property of a media type - perhaps this is the reason why it does not work?

    How can i get the media type property inside my template?

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

    Hi Dominik

    I think you confuse the concept of macro properties.

    If you insert 1 into the position like position="1" instead of #bannerPosition it will probably work.

    If you want to insert #bannerPosition then you need to have a property on your document type called "bannerPosition" where the value of the banner position is stored. This can be used when you insert the macro directly in a template.

    If you insert the macro inside a rich text editor then the above approach by fetching the value from the macro parameter should be used. The value comes from the value, which is inserted into the parameter field during the insertion by the editor.

    I hope the above makes sense and helps you move forward? :-)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft