Copied to clipboard

Flag this post as spam?

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


  • Enrico 47 posts 252 karma points
    Mar 06, 2017 @ 12:54
    Enrico
    0

    Vorto and Tag Editor issue

    Hi everyone,

    I sued the Vorto plugin to wrap the tag editor. I am using Umbraco 7.5.6 and the serialized object created by the plugin is like the following:

    <tags><![CDATA[{"values":{"en-US":"[\r\n  \"Asian Games 2026\",\r\n  \"Japan\",\r\n  \"Nagoya\",\r\n  \"Olympic Council of Asia\"\r\n]"},"dtdGuid":"4b64c25e-2452-4182-9d9e-fb207425f3a3"}]]></tags>
    

    In order to display the tag in my view, I do the the following:

    @foreach (var item in newsSectionItems)
    {
        String[] tags = item.HasVortoValue("tags") ? sitem.GetVortoValue<string>("tags").Split(',') : null;
    
           if(tags != null){
    
    
                 foreach (var itemTag in tags)
                 {
                   <span>@itemTag</span>
                  }
    
          }
    
    }
    

    The result is unexpected - I get on my page:

    [ "Asian Games 2026" "Japan" "Nagoya" "Olympic Council of Asia" ]

    Did anyone have experienced this behaviour?

  • Enrico 47 posts 252 karma points
    Mar 06, 2017 @ 15:08
    Enrico
    100

    Hi guys,

    I found myself the solution.

    I hope this could help.

     @foreach (var item in newsSectionItems)
    {
        var tags = item.HasVortoValue("tags") 
    ? Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(sitem.GetVortoValue<string>("tags"))
     : null;
    
           if(tags != null){
    
    
                 foreach (var itemTag in tags)
                 {
                   <span>@itemTag</span>
                  }
    
          }
    
    }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies