Search code examples
macrostitlekentico

Kentico: Can i get Page Title via nodeID?


I would like to display a list of a couple of my pages in a list.

Is there a macro or something else to get the page title of another site then the actual one? All i need is a little smart function that can give me the name of a page.

Thanks for your help.


Solution

  • If you have the nodeID of the page you want the title of, you can use the TreeHelper static functions.

    TreeNode yourNode = TreeHelper.SelectSingleNode(nodeID);
    

    then easily enough access the name from there.

    yourNode.DocumentName;
    

    Note the difference between a TreeNode and a Document is that there are possibly multiple Document's for one TreeNode, where each is a different language/culture.