Copied to clipboard

Flag this post as spam?

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


  • CodeMaster2008 151 posts 184 karma points
    May 28, 2010 @ 20:12
    CodeMaster2008
    0

    Retrieving all pages from code behind

    Hi;

    What i need is a list of all pages on the website, something like:
    Home, Page1, Page2, Page3 ... and so on.
    I know i can get there with xslt but I'm starting to learn the umbraco API and got confused here.

    On umbraco TV we have some sample code/video like this:

            Dim curPage As Node = Node.GetCurrent
            For Each nd In curPage.Children
                ' do somehint here
            Next

    The code above will list pages under the current page right? So, how can i list all pages, is there something like "Node.GetAll"?

  • Stefan Kip 1614 posts 4131 karma points c-trib
    May 28, 2010 @ 22:03
    Stefan Kip
    0

    You can use Node root = new Node(-1) as far as I know...

    -1 is the root (content) node if I remember correctly, then you can get children and the children's children and so on...

  • Chris Dunn 210 posts 401 karma points
    Jun 02, 2010 @ 19:33
    Chris Dunn
    0

    There is an umbraco.library function call GetXMLAll() which returns all the xml from the cache.  The value returned is xpathnodeiterator so you can loop through the content nodes.

    http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlall

    -Chris

  • 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