Copied to clipboard

Flag this post as spam?

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


  • kodermax 39 posts 59 karma points
    Jun 18, 2015 @ 13:39
    kodermax
    0

    how can i use another page

    I know CurrentPage, but how can i use homepage.alias?

  • Carl Jackson 139 posts 478 karma points
    Jun 18, 2015 @ 16:00
    Carl Jackson
    0

    Try

    @{
        var homepage = Umbraco.TypedContentAtRoot().FirstOrDefault();
    }
    

    This will get the first root node in your content tree.

  • Carl Jackson 139 posts 478 karma points
    Jun 18, 2015 @ 16:10
    Carl Jackson
    0

    In my base project I'm also using

    CurrentPage.Site()
    

    But note sure where that came from to be honest as a quick google doesn't find much and its not a custom extension I have wrote.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 18, 2015 @ 19:13
    Dennis Aaen
    1

    Hi Carl,

    One of the new features in Umbraco 7.2 back when it was released was the query builder. The purpose with the query builder was to make eaier for new people to Umbraco to get data our of the system.

    http://umbraco.com/follow-us/blog-archive/2014/12/4/umbraco-72-released

    So instead of this:

    @CurrentPage.AncestorOrSelf(1);
    

    Then you can do:

    CurrentPage.Site()
    

    You can hear more about the query builder in the keynote from the last year CodeGarden in Copenhagen. http://stream.umbraco.org/video/9918428/umbraco-codegarden-14-keynote

    If you donĀ“t want to see the whole keynote then the part about the query builder starts in the 26 minute.

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft