Copied to clipboard

Flag this post as spam?

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


  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Nov 01, 2013 @ 00:03
    Anthony Dang
    0

    Automatic dictionary items

    I just had a thought. 

    Wouldnt it be great if you could just do this in your cshtml:

    Umbraco.GetDictionaryItem("MyItem", "defaultValue")

    And umbraco would create the dictionary item with the "defaultValue" for all the languages.
    I'm not sure how you would handle dictionary item hierarchy though.
    Thoughts?
    Any alternatives?
  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Dec 03, 2013 @ 23:51
    Nicholas Westby
    0

    uQuery allows for that syntax, as in this example: 

    @uQuery.GetDictionaryItem("key", "fallback")

    Though, as far as I know, it doesn't actually create the dictionary item if it doesn't exist. Just returns the default value if it doesn't exist.

    From what I've read, uQuery is supposed to be replaced by UmbracoHelper, though I don't see that overload for GetDictionaryItem on it yet (as of Umbraco 6.1.6).

Please Sign in or register to post replies

Write your reply to:

Draft