Copied to clipboard

Flag this post as spam?

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


  • Wouter Boevink 10 posts 32 karma points
    Dec 09, 2010 @ 13:22
    Wouter Boevink
    0

    Use a dictionary item in the content

    How can I use a dictionary item in the content?

    <?UMBRACO_GETITEM field="#Field"/>

    This works inside a template, but I want to use it in the content like this:

  • Tom Maton 387 posts 660 karma points
    Dec 09, 2010 @ 13:27
    Tom Maton
    0

    Hi Wouter

    Try using the content as a rich text editor instead of just a standard text box as this would render it differently as you can add macros into an RTE which render like a dictionary item

    Thanks

    Tom

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Dec 09, 2010 @ 13:32
    Morten Bock
    0

    Which version of umbraco are you using? Looks like an older syntax?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Dec 09, 2010 @ 13:45
    Morten Bock
    0

    Looking at the source, I don't think that what you are trying to do would work. It could potentially create an endless loop, since you could be writing out the same field that your getitem tag is in, thus causing it to render itself.

    I would instead go with creating a macro, that writes out the dictionary item for you, based on an input parameter.

  • Wouter Boevink 10 posts 32 karma points
    Dec 09, 2010 @ 13:46
    Wouter Boevink
    0

     

    @Tom Maton the macro works without any problems. I could write a macro which gets the dictionary item, but thats imho a workaround.

    @Morten Bock I'm using the latest version 4.5.2. What's the correct syntax the use? I searched the documentation, forum, googled it. But couldn't find anything.

  • Wouter Boevink 10 posts 32 karma points
    Dec 09, 2010 @ 13:49
    Wouter Boevink
    0

    So there's no tag for using a dictionary item?

    Maybe something like {Locallink:1234}?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Dec 09, 2010 @ 14:03
    Morten Bock
    0

    The syntax would be like this:

    <umbraco:Item field="#RenteDisclaimer" runat="server"></umbraco:Item>

    Try it out, but I don't think it will work. Let us know.

  • Wouter Boevink 10 posts 32 karma points
    Dec 09, 2010 @ 14:13
    Wouter Boevink
    2

    Nope, that doesn't work since it doesn't get parsed by .net, tried it anyway :-)

    I resolved it by using a macro which gets the dictionary item provided by a macro parameter.

    Thanks all for your support.

    For future reference :-)

    <?UMBRACO_MACRO macroAlias="GetDictionaryItem" dictionaryItem="RenteDisclaimer"/>

    ----- GetDictionaryItem.xslt ----

    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:variable name="dictionaryItem" select="/macro/dictionaryItem"/>

    <xsl:template match="/">
      <xsl:value-of select="umbraco.library:GetDictionaryItem($dictionaryItem)" disable-output-escaping="yes" />  
    </xsl:template>

    </xsl:stylesheet>

Please Sign in or register to post replies

Write your reply to:

Draft