Copied to clipboard

Flag this post as spam?

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


  • Halldór Hrafn Gíslason 30 posts 50 karma points
    Nov 22, 2010 @ 15:09
    Halldór Hrafn Gíslason
    0

    Smart use sub Dictionary nodes ?

    Hi,

    I noticed that I can add sub (child) nodes to dictionary items. I'm using dictionary items both in html and codebehind, so I'm wondering if I could use this feature in a smart/clean manner so that I can segment my dictionary in a more convenient way. For example:

    If I have many pages (or user controls) that each has many properties that I'd like to translate using dictionary items.

    Could I then create some sort of hiarchy where the page/usercontrol would be the parent of the properties?

    For example (dictionary):
      SomePage
      -- Name
      -- Address
      -- Country
      SomeOtherPage
      -- SomeProperty
      -- SomeOtherProperty
    etc..

    Then I'd like to access this in some way like this: umbraco.library.GetDictionaryItem("SomePage_Name")   (or however I could do it?)

    Then how would I also to that using <umbraco:Item ... /> ?

    With thanks.

  • Halldór Hrafn Gíslason 30 posts 50 karma points
    Nov 23, 2010 @ 09:28
    Halldór Hrafn Gíslason
    0

    Turns out that this is a non-issue. When you set up your dictionary in such a hirachy, you still refer to it's elements as if the hirachy was flat.

    For example; if you have the same structure as above, you can do this: umbraco.library.GetDictionaryItem("Address") and also umbraco.library.GetDictionaryItem("SomeOtherPage").

    Be aware that even though elements are set up in a hiarchy, they still have to be universally unique. For axamle SomePage / Name and SomeOtherPage / Name is not unique since Name = Name.

    Home this helps someone :)

Please Sign in or register to post replies

Write your reply to:

Draft