We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19873
    • 67 Posts
    How do I get the text label of the category of the current page? getResources and Ditto do not seam to return this value. I am trying to set a class for my BODY tag to style the page, and Category seems like a natural way to do this.
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      Pages don’t have a category assigned to them by default. Chunks, templates, Snippets, plugins... all of those elements can be put into a single category via the GUI on the Elements tab, but a page (i.e. a resource) is not normally categorized.

      You can use an Auto-Tag template variable to tag pages, which is similar in functionality. Maybe I’m misunderstanding you... could you explain more how you’re organizing your pages?
        • 19873
        • 67 Posts
        Thanks for your response.

        I have a simple site with top level sections and 3 or 4 sub-pages. I want the category of the top level pages to be written into the body tag as a basis for styling. So I need some type of identifier that is common to all pages in the category. I would rather NOT use a TV unless I have to for simplicity (I already have a lot of TVs for other reasdons.)
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          It’s kinda cheating, but could you make use of the [[*parent]] tag in your classes? E.g.

          <body class="mystyle_[[*parent]]">


          That would guarantee that all your main folders @ the root of the site would have the same body class because they all have the same parent.
            • 3749
            • 24,544 Posts
            If you’re not using the description, longtitle, or summary (introtext) fields, you could put something there.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 19873
              • 67 Posts
              Thanks for the responses and the explanation of Category. I resorted to another template variable, satisfied that I had exhausted other possibilities.