Copied to clipboard

Flag this post as spam?

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


  • Jake 2 posts 32 karma points
    Oct 04, 2013 @ 03:59
    Jake
    0

    Attempting to get nice url from Ultimate Picker

    I have been trying to get the nice url and node name from nodes selected in the Ultimate Picker property on a page and can't seem to get it right in Umbraco v6.1.5. 

    I am able to output the node ids as strings but not pass them into NiceUrl() to output. Here's what I have now to output the id strings:

     

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    <ul class="row">

              @foreach(var link in CurrentPage.footerLinks.Split(',')) {

              <li class="large-3 columns"><a href="#">@link.ToString()</a></li>

              }

    </ul>

     

    This simply outputs a list of node ids of course. I have tried to use @Umbraco.NodeById(link.ToString()).NiceUrl() and variations of that to pass into the href but get compilation errors each time. 

    Thanks in advance guys.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Oct 04, 2013 @ 10:35
    Jeavon Leopold
    0

    Hi Jake,

    Essentially, I think you only need to use Umbraco.Content(link) but take a look at the Mvc dynamic example for ultimate picker here

    You might also be interested in this package which takes away the need to split every time you need to output.

    Jeavon

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Oct 04, 2013 @ 10:36
    Ali Sheikh Taheri
    101

    Hi Jake,

    just use @Umbraco.TypedContent(link).Url NiceUrl is obsolete.

    so your code would be

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    
    <ul class="row">
    
              @foreach(var link in CurrentPage.footerLinks.Split(',')) 
              {
               var linkeNode = Umbraco.TypedContent(link.ToString());
              <li class="large-3 columns"><a href="@linkeNode.Url">@linkeNode.Name</a></li>
    
              }
    
    </ul>
    
  • Jake 2 posts 32 karma points
    Oct 07, 2013 @ 20:16
    Jake
    0

    Thanks guys, Ali's solution worked.

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Oct 07, 2013 @ 20:17
    Ali Sheikh Taheri
    0

    Hi Jake,

    Glad it worked, it would be great to mark it as solved so other people can easily find the answer.

    Cheers

    Ali

Please Sign in or register to post replies

Write your reply to:

Draft