We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40088
    • 708 Posts
    I just started using MODX so this may be obvious. I installed TinyMCE and I've noticed (when viewing the browser source code) that my nicely formatted code only lasts until I make an edit after which it gets aligned left with no indenting. Granted this isn't the worst thing but is there no way to ensure the formatting isn't lost with a RTE?

    Thanks
      Todd
      • 19369
      • 1,098 Posts
      Hi,

      You shouldn't place your code directly in the main content area unless you really need to. AFAIK, TinyMCE will mess up the code regardless the CMS you use, as it's an external app intended to be used by end users with little HTML knowledge.

      I don't know exactly what you're trying to accomplish, but probably there's a better place where you can place your code.
        • 40088
        • 708 Posts
        Hi,

        Putting the code in the main content area (via TinyMCE) seemed logical since it is ... the main content of the page, and I didn't see any point in breaking it up into pieces, like TVs, for example. Though maybe that's what I need to do. But mostly the reason I did it this way is because the client needs a WYSIWYG editor. I'm surprised at how crappy most of these RTEs are, at least the ones that can be installed in MODX. I wish there were more MODX/RTE options available.

        In any case I'm still trying to find my MODX workflow and while it would be nice (though not essential) to maintain the formatting if possible I would also be interested in hearing how others approach this.
          Todd
          • 4172
          • 5,888 Posts
          Rule 1:
          If you want your html-code to be as untouched as possible, don't use any RTE.

          But mostly the reason I did it this way is because the client needs a WYSIWYG editor.

          what exactly is the reason your client needs an RTE ?

          There are many ways arround using them. But it depends on which kind of content he wants to add. So let us know more about the scenario.

          If there is really no way arround it, in your clients case, there are still lots of configuration-options for tinyMCE.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 19369
            • 1,098 Posts
            You are right, RTEs very often behave badly, but there is not much alternative at the moment.
            Can you please provide an example of the code you're placing on TinyMCE, so that we can understand if you're using MODX in the right way?
              • 40088
              • 708 Posts
              Quote from: Bruno17 at Jun 11, 2012, 10:05 AM
              Rule 1:
              If you want your html-code to be as untouched as possible, don't use any RTE.

              what exactly is the reason your client needs an RTE ?


              Rule 1: No argument there. However, (thankfully) this particular client wouldn't go near the markup for love nor money. In any case the client just prefers a visual editor.

              Here's a stripped-down example of the main content markup I placed in TinyMCE:

              <div id="content">
              	<div id="trans">
              		<div id="frame">
              			<p id="slider"></p>
              		</div>
              		<h1></h1>
              	        <div id="quote">
              			<h2><a href=""></a></h2>
              			<p></p>
              			<blockquote></blockquote>
              		</div>
              	</div>
              	<div id="new">
              		<p></p>
              		<h3></h3>
              		<p></p>
              		<h3</h3>
              		<p></p>
              	</div>
              </div>
              


              Regarding RTEs, the only one I've found that handles markup effectively is XStandard which of course is not currently an option for MODX. A shame, really. I hope that changes.
                Todd
                • 19369
                • 1,098 Posts
                This is how I'd do it:
                <div id="content">
                    <div id="trans">
                        [[$slider]]
                        <h1>[[*longtitle]]</h1>
                        <div id="quote">
                            [[*content]]
                        </div>
                    </div>
                    <div id="new">
                        [[*secondary-content]]
                    </div>
                </div>
                  • 4172
                  • 5,888 Posts
                  ok, I see. The modx-way would be to create a template with something like that:
                  [[$yourhead]]
                  <div id="content">
                      <div id="trans">
                          <div id="frame">
                              <p id="slider">[[snippetToCreateSlides]]</p>
                          </div>
                          <h1>[[*pagetitle]]</h1>
                              <div id="quote">
                              <h2><a href="???"></a>???</h2>
                              <p>[[*content]]</p>
                              <blockquote>????</blockquote>
                          </div>
                      </div>
                      <div id="new">
                          [[snippetWhichListsItems]]
                      </div>
                  </div>
                  [[$yourfooter]]
                  


                  slides can be filled for example with something like MIGX
                  the 'new' - box can be filled for example with contents of subresources by getResources or also .... with MIGX, depending on what kind of content comes into that box.

                  So your client needs just to add real content and has nothing todo with the html-structure.
                  [ed. note: Bruno17 last edited this post 14 years, 3 months ago.]
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 40088
                    • 708 Posts
                    Quote from: Bruno17 at Jun 11, 2012, 11:24 AM

                    slides can be filled for example with something like MIGX
                    the 'new' - box can be filled for example with contents of subresources by getResources or also .... with MIGX, depending on what kind of content comes into that box.

                    Thanks to both of you, these are good suggestions. There's a lot I don't know about MODX such as MIGX and getResources so I'll need to learn what they are and how to use them.
                      Todd
                      • 19369
                      • 1,098 Posts
                      getResources is a flexible snippet that allows you to display the content from other pages, so, for example, you can use getResources to generate a list of news or a list of recent blog articles. You could use getResources for your id="new" section.

                      With MIGX you can create slideshows, galleries and much more. You could use MIGX for your id="slider" section.