We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26016
    • 561 Posts
    Hi,
    I am quite intrigued by the idea of having to put content directly in the template. It’s absolutely possible, of course. I actually do it myself sometimes when no one is looking. smiley But it would seem much, much easier to use TV’s (or even chunks) for this content, no matter where it goes in the template.

    I can see being worried that the clueless client may mess them up, but you can make TV’s only editable by the super admin.

    I could sort of see it if you had the same content on each page, but from an SEO perspective, that’s not good, so I assume it can’t be that. So you’re left with making tons of templates, I guess. Ouch!

    I would be interested in knowing why you need to do this from a design perspective.

    Cheers
      MODx and Wordpress development
      Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
      • 37437
      • 147 Posts
      The reason that I populated the template with viewable site content is because the basic site design consists of two basic columns -- a main column and a secondary, side column. The content that appears in the main column is different on every page, and therefore, is added to directly to the pages themselves. However, the content appearing in the side column is often the same from one page to the next, and therefore, I elected to simply place one iteration of this content in the template that is used by the associated pages. This strategy allows me to avoid having to repeatedly place the same content on different pages (the template does it for me).
        • 3749
        • 24,544 Posts
        Normally, you’d put that content in a chunk, put a chunk tag [[$chunkName]] in the template where you want the content to appear, and use the same template for each page. It saves having to edit many templates when you want to change the design. The search engines will have no way to know where the content came from. To them, it’s part of the page.
          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
          • 20358
          • 10 Posts
          On my site, I have a simple two colum layout that sounds similar to yours. The left is the "main" area where I call content from the resources/pages. In the right column, my template has an empty div that simply calls a TV I create called "sub-content" which is just a plain text area. The actual content is then saved in various chunks, which I call from my TV and have set as a *default* value. I only have a few pages where this will ever need to change, so with this setup, I only ever need to change the sub-content area on very few pages. This setup is also quite modular, so if only one peice of the sub-content area needs to change, I can just create/call a different chunk.

          I haven’t yet messed around with locking the TV for editing, as I am the only user on this site, but it looks like that option is readily available to keep other users from accidentally messing those areas up.

          Swill
            • 33997
            • 150 Posts
            Quote from: Mr. at May 06, 2011, 06:59 PM

            On my site, I have a simple two colum layout that sounds similar to yours. The left is the "main" area where I call content from the resources/pages. In the right column, my template has an empty div that simply calls a TV I create called "sub-content" which is just a plain text area. The actual content is then saved in various chunks, which I call from my TV and have set as a *default* value. I only have a few pages where this will ever need to change, so with this setup, I only ever need to change the sub-content area on very few pages. This setup is also quite modular, so if only one peice of the sub-content area needs to change, I can just create/call a different chunk.

            I haven’t yet messed around with locking the TV for editing, as I am the only user on this site, but it looks like that option is readily available to keep other users from accidentally messing those areas up.

            Swill
            Ditto. When I have content that is similar but switches around, a TV with chunk names (and if only used once, the actual code) is the way that I usually go.
              "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
              • 37437
              • 147 Posts
              Thanks for the info. I will definitely reconsider my design strategy going forward. That said, is there anything actually ’wrong’ with putting textual content directly into a template?
                • 33997
                • 150 Posts
                I believe one of the most beautiful features of MODX is that there is no way to do anything ’wrong’, unless it results in a syntax error. As long as it makes sense to you, and you feel it will continue to work as the site scales, then it is right.
                  "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
                  • 3749
                  • 24,544 Posts
                  Quote from: marconi at May 09, 2011, 02:19 PM

                  Thanks for the info. I will definitely reconsider my design strategy going forward. That said, is there anything actually ’wrong’ with putting textual content directly into a template?

                  It’s just a question of maintenance. If the text will appear in all docs with that template and no docs with other templates, there’s nothing wrong with it. If you have a lot of templates with the same content, though, you have to edit them all to change it.

                  It’s "wrong" from an MVC standpoint, because in theory, you want to completely separate the "view" (formatting) from the "content," but if it works for you, go for it.
                    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
                    • 33997
                    • 150 Posts
                    Quote from: BobRay at May 09, 2011, 08:15 PM

                    It’s just a question of maintenance. If the text will appear in all docs with that template and no docs with other templates, there’s nothing wrong with it. If you have a lot of templates with the same content, though, you have to edit them all to change it.
                    You can easily fix this by placing that re-usable content in a chunk and calling the chunk from within your templates. I believe I saw someone write that you basically want to use chunks for anything you are going to write more than 3 times.

                    Quote from: BobRay at May 09, 2011, 08:15 PM

                    It’s "wrong" from an MVC standpoint, because in theory, you want to completely separate the "view" (formatting) from the "content," but if it works for you, go for it.
                    Didn’t think of it from that standpoint, thanks!
                      "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
                      • 37437
                      • 147 Posts
                      I ’chunked’ up all the content. the templates are much cleaner now. again -- thanks.