On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Not that anyone has ever run into a client that can’t seem to get their content written... but just in case you ever do in the future, here’s a good technique to "finish" off functionality on a site. Hopefully it can speed up the payment cycle for someone.

    1) Create a TV [*mainCopy*].

    2) For the default value, use the following:
    @EVAL return ($modx->documentObject['content'] > '')? $modx->documentObject['content'] : '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque orci purus, pulvinar mollis, hendrerit sit amet, porttitor nec, enim. Sed quis urna. Etiam dignissim fermentum turpis. Etiam luctus. Duis ut dolor. Aenean sed velit lacinia augue bibendum posuere. Vestibulum sit amet arcu et leo pharetra iaculis. Integer malesuada gravida risus. Integer vitae nulla. Maecenas nec erat. Fusce vel metus nec purus venenatis tempus. Ut tortor. Praesent id dui. Suspendisse potenti.</p>';


    3) Instead of [*content*] in your template, use [*mainCopy*].

    What it does:
    It uses an @binding to evaluate if there is actually content in your content field. If there is, it uses it. If not, it places in "lorem ipsum" text (or whatever you choose to substitute).

    When all the content is finally written, delete the TV and replace it in your templates with [*content*] to cut down on unnecessary overhead.

    Enjoy.
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
    • Now that’s something I’ll most definitely use !

      Thanks for the tip Ryan grin !
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l&#39;outil id
      • Now I will have to restrain myself from putting "When these idiots ever get around to actually deciding what they want to put here, there will be real content in this space."
          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
        • Nice tip, Ryan! Extremely useful.

          Thanks for sharing smiley
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: support@modx.com
            Twitter: @garryn
            Web: modx.com
          • Nice tip, Ryan! Thanks!

            Now I will have to restrain myself from putting "When these idiots ever get around to actually deciding what they want to put here, there will be real content in this space."

            LOL!
            • Will some later releases support the @INHERIT for the contentfield

              would be nice to just type @INHERIT in your contentfield en get the content from the above folder.
              I tryed it in 0.9.1. rev646 there it did not work

              Dimmy
                follow me on twitter: @dimmy01
              • Quote from: sottwell at Apr 25, 2006, 04:12 AM
                Now I will have to restrain myself from putting "When these idiots ever get around to actually deciding what they want to put here, there will be real content in this space."

                lol

                I’ll join you howling at the moon on this one grin !!!
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id
                • @bindings won’t work in the content fields.
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • Quote from: rthrash at Apr 25, 2006, 01:01 PM

                    @bindings won’t work in the content fields.

                    but would it be posible at all with a core hack?
                      follow me on twitter: @dimmy01
                    • Quote from: Dimmy at Apr 25, 2006, 05:09 PM

                      Quote from: rthrash at Apr 25, 2006, 01:01 PM

                      @bindings won’t work in the content fields.

                      but would it be posible at all with a core hack?

                      Would be messy at this point. 1.0 will feature this ability on all "content elements," and the main [*content*] for each page will qualify for this.