We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17720
    • 21 Posts
    I am a designer leaning to convert HTML pages to templates. I am familiar with chunks and snippets but i do not write any php.

    I am am not exactly clear on how Modx picks up on classes in the resource content area. For example as someone with an editor role,
    adds new content using the TinyMCE tool how do you assure the the new content uses the proper ids and classes? Does anyone have any examples I can look at?

    For instance
    I use a class for a container div and all the tags inside that uses are referenced from that class in the style sheet.
    <div class="features">
    <h2>heading</h2>
    <p><a href>feature text.</p>
    </div>

    css
    div.features{colour:#000}
    .features p {color:#D8F2FF}
    .features a {color:##87CEEB }
    .features h2 {font:bold 120% Arial,sans-serif}

    But there are some exceptions when a class is used on containers inside a Div for example:
    <div class="features">
    <h2>heading</h2>
    <p >feature <span class="special">text</span></p>
    </div>

    Is there a way to preserve these inline classes?

    Thank you,
      • 15152
      • 360 Posts
      This should all be controlled by your chunk/ditto call and which template is used.
        There are no boring projects. Only boring executions. ~ Etzkorn
        www.impress-design.com
        • 3749
        • 24,544 Posts
        You should only have a few templates (meaning the things that are in Elements | Manage Elements | Templates) -- possibly only one.

        The little template-like things used by Ditto and other snippets are called Tpl chunks (or just Tpls).

        Ditto (and its ilk) just grabs a specified series of resources and uses their fields to repeatedly fill the Tpl chunks. Then it strings them all together and returns them.

        MODx itself does nothing with those classes other than just output what is returned from Ditto. Your CSS then determines how that output is displayed.

        Hope this makes sense.

          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          It’s all in your CSS file anyway, whether it’s Ditto making these or you have them in your content. I always look at a "view source" of a page, then add all of the IDs and classnames I see into my CSS file with empty {} containers. Then I start going through them one by one adding the rules that are needed.
            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