We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16357
    • 27 Posts
    Hi,

    Is there an easy way of getting the documents grandparent id? I’d like to see something like [*id-1*] to go to parent, [*id-2*] to go to grandparent, [*id-3*] to go to grand grandparent etc. Is that possible? If not, that’s on my wishlist smiley

    Another thing I miss is an option to decide what document template children of a folder should have default on creation. Something like:

    Root
    Projects (template: projectlist, childrens template: projectpage)
    Project A (template: projectpage, childrens template: i.e. picturetemplate)

    I haven’t seen that option anywhere in MODx, but perhaps I have overlooked it? It would be very nice not having to change the template of every new created document on folders you know will have a certain type of template.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      There is the "inherit template" plugin that automatically lets documents inherit the template of their parent.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 16357
        • 27 Posts
        Yes, I’ve seen that one. The problem is that the children won’t have the same template as its parent, therefore the inherit template won’t work.
          • 10487 MODX Staff
          • 1,535 Posts
          Yes there is a way, Jason (OpenGeek) wrote a snippet that will do that for you ... now, I just need to find the link for you ...
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 16357
            • 27 Posts
            That would be brilliant smiley
              • 10487 MODX Staff
              • 1,535 Posts
              Okay, the thread is here (works on MODx 0.9.5): http://modxcms.com/forums/index.php/topic,7343.0.html (EDIT: this answers your first question, btw - didn’t read your first post all the way, I will think about the second question though)

              EDIT 2: Actually, I have a real need for this in a slightly different way (it’s for a blog) so I’ll have a look tomorrow if I get time - I seem to remember in the distant past that I did a mod on Inherit Template to have parent=>child template mappings so it was possible to define inheritance in the way you described. I can’t find it now but it shouldn’t be too hard to recreate.
                Garry Nutting
                Senior Developer
                MODX, LLC

                Email: [email protected]
                Twitter: @garryn
                Web: modx.com
                • 16357
                • 27 Posts
                Great. Thanks smiley