Copied to clipboard

Flag this post as spam?

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


  • Karl Walker 10 posts 30 karma points
    Sep 30, 2010 @ 15:56
    Karl Walker
    0

    Passing Dictionary Items Into Macro Template Calls (Not Working)

    I've been wrestling with this one for a good few hours now.

    I have a master page (template) and its a package based macro, meaning I would have to reflect the code in order to pull dictionary items out within the package itself, because the package is made up from a DLL currently.

    Like I in general pass page property items into a macro as such...

    <umbraco:Macro runat="server" myparam="[$documentTypeField]" />

    I want to do this with a dictionary item in order to make my system multilingual...

    <umbraco:Macro runat="server" packageparam="[#dictionaryTermKey]" />

    This however has no effect and in fact comes out blank.
    I assure you these terms do exist in the Settings -> Dictionary section and these keys do have text values.

    Firstly can this be done?
    If not them wouldn't this be a fundamental problem?

    I understand I should put the code...

    umbraco.library:GetDictionaryItem('dictionaryTermKey') in my XSLT or C# code, but this component is a package based one with a DLL as opposed to source code.

    I have since wrote a MacroWrapper user control using the code (where plhMacro is a placeholder)

    using umbraco.presentation.templateControls;

    Macro mcr = null;
    mcr = new Macro();
    mcr.Alias = ALIAS_OF_MACRO;
    mcr.MacroAttributes.Add("title", umbraco.library.GetDictionaryItem(DICT_TITLE));
    this.plhMacro.Controls.Add(mcr);

    This works for XSLT macros but somehow still doesn't set the UserControl properties in the Macro's User Control

    HELP, any ideas beyond using reflector and extracting the code out and changing it?

    Karl
    (Using Umbraco 4.5.2 under .NET 3.5)

  • Karl Walker 10 posts 30 karma points
    Oct 01, 2010 @ 13:22
    Karl Walker
    0

    Any ideas?

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Oct 01, 2010 @ 14:41
    Richard Soeteman
    2

    Hi Karl,

    You can't insert dictionary item in a Macro using Parameters [#someItem] is a dictionary if you use it in a pageItem but if you pass it into a Macro it has another meaning and that is the name of the propertyAlias on your current page.

    I always pass the name of the dictionary item to the macro and use umbraco.library:GetDictionaryItem($[your dictionaryitem her]) to retreive the translation in the XSLT, or umbraco.library:GetDictionaryItem'("Some dictioneryitem") in my .net Usercontrol to get the translation.

    Cheers,

    Richard

  • Adrian Alexa 50 posts 100 karma points
    Jan 13, 2012 @ 13:33
    Adrian Alexa
    0

    hi, if I write umbraco.library:GetDictionaryItem("Some dictioneryitem") will render content, but if i create a macro that has set as a parameter dict_item and call  umbraco.library:GetDictionaryItem(paramDict) will not render any result, why?

  • Adrian Alexa 50 posts 100 karma points
    Jan 13, 2012 @ 13:50
    Adrian Alexa
    0

    had a mistype, sorry. Is working

  • Marco Fernandes 15 posts 51 karma points
    Jan 17, 2012 @ 15:41
    Marco Fernandes
    0

    Why not put the whole macro tag in the Dictionary? It works! ;-)

Please Sign in or register to post replies

Write your reply to:

Draft