We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6747
    • 3 Posts
    I’m using friendly URLs (friendly aliases and friendly paths turned on), and I’m wondering how to easily return the path to the current document, the path to the parent document, and the path to the grandparent document, and so forth.

    I know I can get the current path with php using $_SERVER[’REQUEST_URI’], but that won’t help so much getting parent and grandparent paths.

    I also know how to get the parent alias like so:

    $modx->getParent(-1,1,'alias');


    But that would be a painful way to build a path, especially if I want the code to be portable and work if the current document is 4 levels deep, or only 2 levels deep in the document hierarchy.

    Thanks.
      • 7804
      • 80 Posts
      As far as I know there is not really a way in MODx to do this. See a discussion on this here:

      http://modxcms.com/forums/index.php/topic,1926.0.html

      Maybe this will give you some workaround ideas.