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

    This is my first time trying out modx, so just trying to break the learning curve here.

    Is there a list online of all the available template variables? Couldn’t find it on the wiki.

    Besides the full list to see what’s available I want to do the following:

    <body id="[*documents_alias]"> or something like that so it shows up as <body id="about"> if I am on the about page or the child of the about page.

    Hope this makes sense.

    Thanks
      • 4310
      • 2,310 Posts
      Try [*alias*]
      Here’s a list http://modxcms.com/document-tvs.html
        • 29847
        • 13 Posts
        Thanks so much Bunk.

          • 29847
          • 13 Posts
          hah..have to say that was insanely easy, looking forward to exploring this cms more smiley
            • 22303 MODX Staff
            • 10,725 Posts
            Just some additional hints and ideas...

            One way to achieve this with inheritance to child docs (as well as the ability to override the value for each child), is to use a Template Variable with the default value of @INHERIT, then set the value on each top level container document to the actual alias.

            Or, you could also just use the GetField snippet in conjunction with the UltimateParent snippet to get the top level parent’s alias no matter where you are in the document tree.

            The latter might be the better choice here, as you can use cached snippet calls in conjunction with the partial page caching MODx provides to reduce the overhead (as compared to having a TV parsed in the template each time).

            My point is simply, there are a lot of ways to do things like this in MODx; finding the best approach to a problem/requirement can be the biggest challenge, and the most fun. wink