Copied to clipboard

Flag this post as spam?

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


  • Mohamed Besher El Said 39 posts 258 karma points
    Sep 23, 2014 @ 15:29
    Mohamed Besher  El Said
    0

    load list of childern of page in other page

    Can i load list of childern (News item )for page (News) in another page say (Home Page) ???? is it possible ?

    that is code of my list 

  • Kevin Jump 2341 posts 14868 karma points MVP 8x c-trib
    Sep 23, 2014 @ 17:17
    Kevin Jump
    1

    HI yes

    you can do it a number of ways - but they all come down to getting the ID of the node and then using that in place of CurrentPage.

    so if you have the ID of the node you can do .

    var newsNode = Umbraco.Content(id)
    

    newsNode will then work in place of CurrentPage in your code.

    Id you put a content picker on your homepage - the editor could pick the node, then you get it like you would any other property

    CurrentPage.NewsNode <-- i think this returns the ID - you have to then put into Umbraco.Content.

    You can pass the node ID into the Macro via a macro paramater. (you have to create a parmeter on your macro then you can get the parameter via @Model.MacroParameters["nodeid"] )

    or you could just for your news node from the root,

    CurrentPage.Descendants("newsitem") 
    

    Will get you all newsitem types below the current node (which is your whole site if it's at the root) - not the fastest thing in the world because you are searching a lot of content.

  • Mohamed Besher El Said 39 posts 258 karma points
    Sep 24, 2014 @ 08:54
    Mohamed Besher  El Said
    0

    thanks Kevin Jump 

    i try that in my macro .plz can you help me with more details

  • Mohamed Besher El Said 39 posts 258 karma points
    Sep 30, 2014 @ 14:47
    Mohamed Besher  El Said
    100

    Model.MacroParameters["nodeid"] ) it is working 

Please Sign in or register to post replies

Write your reply to:

Draft