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,
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
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.
-
☆ 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.