Copied to clipboard

Flag this post as spam?

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


  • Stephen Davidson 216 posts 392 karma points
    Nov 15, 2012 @ 18:10
    Stephen Davidson
    0

    Link back to main site data type

    i want to give my users the ability to add in a new link back to the main site in the top navigation. To facilitate this i have added a content picker data type into the landing doc type.

    I now want to reference this in the uBlogsyNavigation.cshtml but not sure how i go about it..

    can i just create a new variable?

    var mainsitelink = @Model.NodeById(Model.uBlogsyMainSiteLink);

    and then reference it?

    Any advice welcome.

    S

  • Anthony Dang 1404 posts 2558 karma points MVP 2x c-trib
    Nov 16, 2012 @ 15:31
    Anthony Dang
    0

    There's a method called GetLanding()

    var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding().GetPropertyValue("uBlogsyMainSiteLink"));

     


     

  • Stephen Davidson 216 posts 392 karma points
    Nov 16, 2012 @ 15:50
    Stephen Davidson
    0

    Thanks Anthony,

    I've added this into the uBlogsyNavigation.cshtml

     // get all pages

     var nodes = GetPageNodes(landing, Model.Id);

     // Get my return link

    var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding().GetPropertyValue("uBlogsyMainSiteLink"));

    but i'm getting a razor error and in VS2010 i can see that "No overload method for GetLanding takes 0 Arguments".

     

    TIA 

    Stephen

  • Anthony Dang 1404 posts 2558 karma points MVP 2x c-trib
    Nov 17, 2012 @ 17:42
    Anthony Dang
    0

    Sorry....

     

    .GetLanding(Model.Id)

  • Stephen Davidson 216 posts 392 karma points
    Nov 19, 2012 @ 11:49
    Stephen Davidson
    0

    thanks Antony...worked that but out so i now have

     

    // get all pages
    var nodes = GetPageNodes(landing, Model.Id);
    // Get my return link
    var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding(Model.Id).GetPropertyValue("uBlogsyMainSiteLink"));

    @if (Request.Url.AbsolutePath == landing.Url)
    {
    <li><a href="@landing.Url" class="uBlogsy_current">Blog Home</a></li>
    <li><a href="@mainsitelink.Urls" class="uBlogsy_current">Main site</a></li>
    }

            else

            {
    <li><a href="@landing.Url">Home</a></li>
    <li><a href="@mainsitelink.Url" >Main site</a></li>
     }

    But I still get a razor error on the browser...

    Stumped.

    S

                            

     

  • Anthony Dang 1404 posts 2558 karma points MVP 2x c-trib
    Nov 19, 2012 @ 18:56
    Anthony Dang
    0

    var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding(Model.Id).GetPropertyValue("uBlogsyMainSiteLink"));

    @if (Request.Url.AbsolutePath == landing.Url)
    {

     

    you don't need the 2 @'s 

     

     

  • 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