We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24993
    • 19 Posts
    Hi guys,

    New to MODx and rolling out my xhtml/css ported site in a few days time.

    Each main page on my site has a different image/quote at top of right-hand-side column section, with varying adverts below. Because of this I have created a chunk for each different column, and then (related to this thread) created a new template for each page. The only difference in each template is the chunk code. So I have a dozen or so very similar templates, with just the rhs column chunk differing.

    Is this right way? I have more templates than I thought I would need, but cannot fathom use of TV or other solution at this stage. No dynamic user input in column/div/section, just different images/ads.

    Richard
    Hong Kong

      Richard
      Hong Kong
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That’s exactly what TVs are for. One template, with the TV tags in that location, then edit the TV for each resource. You can even use a Rich Text input type if you want to.

      http://sottwell.com/tv-input-types.html
        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
        • 24993
        • 19 Posts
        Thanks Susan,

        Funny thing the brain. I knew I had to use a TV for this but couldn’t get my head around the documentation references to ’the user’. Suffered a mental block until your message when I realized "I" am the user in this case - and not the website visitor that had been in my mind! Have now replaced/deleted all those extra templates with a simple TV. Phew... Next stop my SEO TVs. smiley

        Now the ’penny has well and truly dropped’ on the use of MODx CMS vs my old Dreamweaver xhtml/css approach. No looking back now. A billion+ thanks. Your website explanation
          Richard
          Hong Kong
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I always try to use "visitor" for somebody viewing the site, and "user" for the person managing the site.
            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
            • 24993
            • 19 Posts
            >I always try to use "visitor" for somebody viewing the site, and "user" for the person managing the site.<

            And don’t forget the ’manager’ too! Forgot to mention that, as busily working away in the manager mode I never ever gave a thought to being a user too. Getting there now. smiley
              Richard
              Hong Kong
              • 29344
              • 18 Posts
              Quote from: sottwell at Apr 23, 2010, 03:26 PM

              You can use as many templates as you feel comfortable with. Sometimes I’ll play a game of seeing how much I can twist a single template into different forms using TVs and TV-specified CSS files, but it’s usually more trouble than it’s worth.

              A good idea is to make judicious use of chunks to contain the bulk of your template <head>...<head> section, as well as the footer. That way you don’t have to duplicate any changes to those parts, just editing the chunk will change it for both templates.

              I have seen designs where the template was nothing but a handful of chunk tags, but I find that very difficult to deal with since you can’t see what the basic structure of the template is that way. I prefer to have the "skeleton" HTML tags, with the content of those tags in chunks where it seems appropriate. I do try to never have the text that will be in the final page in the template, just the HTML structure. Everything else is some kind of MODx tag, either site or document variable tags ([(site_name)] and [*pagetitle*] for example), chunks, TVs or snippets.


              I’m very new to modx, so I’m a bit confused on the proper way to use template variables. I understand the concepts behind chunks and snippets, where chunks contain raw html, snippets contain php. When I created my first template, I consolidated all the content of my homepage into 4 chunks: Header, Content, side bar, and footer. That seemed fine until I wanted to use the same template, across the entire site (about, contact, blog, support) but with different information in the content div. Since I "chunked out" the template for the homepage, I had to make 4 different templates, and 4 extra chunks that would be placed in the content. That seemed counter-intuitive. So I searched around and started seeing the [*tag], resource fields?, used but can’t find any articles on how to use them.

              I found this: http://rtfm.modx.com/display/revolution20/Resources#Resources-ResourceFields but it’s still not hitting home for me. undecided

              I presume by using [*content] instead of [[$content]], I’ll be able to change the content within that section without having to make a new template, right? But where/how do I specify what [*content] is? And obviously the content on the homepage will be different than the support page (although all placed within the same div) so how do I tell it to pull the right information? Is that considered a template variable? And on some tutorials, I see that the [*content] is used within the main div, such as:

              <div id="content">
              [*content]
              </div>

              Is this recommended as opposed to putting the div inside the resource field? I’m using Revo if you haven’t already guessed. Any help would be much appreciated!!!
                • 36926
                • 701 Posts
                Quote from: tavcorp at Jan 31, 2011, 02:33 PM

                Quote from: sottwell at Apr 23, 2010, 03:26 PM

                You can use as many templates as you feel comfortable with. Sometimes I’ll play a game of seeing how much I can twist a single template into different forms using TVs and TV-specified CSS files, but it’s usually more trouble than it’s worth.

                A good idea is to make judicious use of chunks to contain the bulk of your template <head>...<head> section, as well as the footer. That way you don’t have to duplicate any changes to those parts, just editing the chunk will change it for both templates.

                I have seen designs where the template was nothing but a handful of chunk tags, but I find that very difficult to deal with since you can’t see what the basic structure of the template is that way. I prefer to have the "skeleton" HTML tags, with the content of those tags in chunks where it seems appropriate. I do try to never have the text that will be in the final page in the template, just the HTML structure. Everything else is some kind of MODx tag, either site or document variable tags ([(site_name)] and [*pagetitle*] for example), chunks, TVs or snippets.


                I’m very new to modx, so I’m a bit confused on the proper way to use template variables. I understand the concepts behind chunks and snippets, where chunks contain raw html, snippets contain php. When I created my first template, I consolidated all the content of my homepage into 4 chunks: Header, Content, side bar, and footer. That seemed fine until I wanted to use the same template, across the entire site (about, contact, blog, support) but with different information in the content div. Since I "chunked out" the template for the homepage, I had to make 4 different templates, and 4 extra chunks that would be placed in the content. That seemed counter-intuitive. So I searched around and started seeing the [*tag], resource fields?, used but can’t find any articles on how to use them.

                I found this: http://rtfm.modx.com/display/revolution20/Resources#Resources-ResourceFields but it’s still not hitting home for me. undecided

                I presume by using [*content] instead of [[$content]], I’ll be able to change the content within that section without having to make a new template, right? But where/how do I specify what [*content] is? And obviously the content on the homepage will be different than the support page (although all placed within the same div) so how do I tell it to pull the right information? Is that considered a template variable? And on some tutorials, I see that the [*content] is used within the main div, such as:

                <div id="content">
                [*content]
                </div>

                Is this recommended as opposed to putting the div inside the resource field? I’m using Revo if you haven’t already guessed. Any help would be much appreciated!!!

                The html that’s used to structure your page goes in you template or you can split into chunks and then place those chunks in the template.

                You would only really need a different template is the main structure of the html changes. So say you have 2 column or 3 column page. You’d have a 2 column or 3 column template. But you’d be able to share a lot of the chunks as most of the code will be the same.

                You then place recourse fields into your template or chunks. So what you put above, is correct:

                <div id="content">
                [*content]
                </div>

                Now edit the content fields within your pages and what ever you put in there will render in between the #content div when you view that page.

                The same would be for [*pagetitle] For example you could put:
                <h1>[*pagetitle]</h1>

                Hope that helps

                  • 29344
                  • 18 Posts


                  Now edit the content fields within your pages and what ever you put in there will render in between the #content div when you view that page.

                  The same would be for [*pagetitle] For example you could put:
                  <h1>[*pagetitle]</h1>

                  Hope that helps




                  Hey! Thanks a lot for responding, but my question didn’t really get answered, so let me try to re-phrase smiley. In response to the quoted text above, where exactly do I edit content fields? I understand that by placing [*content] within the template, I’m able to render my content, but where do I create that content? If it’s not a chunk, snippet, or TV, where do I put it??
                    • 36926
                    • 701 Posts
                    Quote from: tavcorp at Jan 31, 2011, 04:06 PM



                    Now edit the content fields within your pages and what ever you put in there will render in between the #content div when you view that page.

                    The same would be for [*pagetitle] For example you could put:
                    <h1>[*pagetitle]</h1>

                    Hope that helps




                    Hey! Thanks a lot for responding, but my question didn’t really get answered, so let me try to re-phrase smiley. In response to the quoted text above, where exactly do I edit content fields? I understand that by placing [*content] within the template, I’m able to render my content, but where do I create that content? If it’s not a chunk, snippet, or TV, where do I put it??

                    When you edit a resource (page) from the tree in the left hand side.

                    What you may find very useful is the demo content. I believe you can install this via the package management, but WARNING anything you’ve done so far will be wiped. So either create a new install to have a play around or if you don’t mind lose you progress so far then go for it.

                    To download it, when you in manager:
                    system >> Package Management
                    Click the Download Extras Button
                    Then in the pop up select the folder:
                    Site Packages >> Demosites >> The download the 3rd in the list MODX SAMPLE SITE

                    I repeat this WILL WIPE ALL YOU CONTENT.

                    Good luck!

                      • 29344
                      • 18 Posts
                      Benny,

                      Thanks for the help, I’ll give that a go.