We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10839
    • 51 Posts
    I have another general question about using MODx in a productive way.

    As far as I understand, a different template is needed for each different "kind" of document.

    For example, if I have a group of documents that belong to a kind of content (say, books) with particular TVs ("book author", "book title", etc.), they will probably share the same "template" (and that template will have PHs such as [+booktitle+], etc.).

    Now, I have another group of documents that correspond to another kind of content (say, football players), with other customized TVs, etc. They will be assigned another template containing those "football" TVs.

    And so on.

    But, in fact, those different HTML templates are essentially the same --there are only some little differences between them.

    So, which is the right strategy in order to re-write HTML code just once, each time I want to perform a general style change in ALL the templates??

    Should I use "big chunks" that would contain the HTML content that is common to all the templates in my site? Is there a best way to proceed??

    [Well, I know that there should be a unique CSS file for all the templates, that’s right. But...]

    As you can see, I am a bit lost a the moment. Each step in MODx is taking me too long, I think.

    I mean, I already have a clean HTML/CSS sketch of a template for a standard page in my site. How should I "translate" it into several MODx templates??

    Thank you in advance.
      GinerBosk smiley

      If you can dream it, you can do it.
      • 7231
      • 4,205 Posts
      That is a question that we all ponder. I will break templates down into chunk parts but keep the body section in the template since it may change for special situations. You could end up with a template that looks like this:

      {{header}}
      {{body}}
      {{footer}}

      Or I guess a template that looks like this will work, but I have never used one this way even though it seems efficient:

      {{myTemplate}}

      Where all the content is stored in the chunks. I think that once the data is in the cache it will not make much difference.
      You could also have the template as an external file and include it via a snippet.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 3749
        • 24,544 Posts
        I generally keep trying to use a single template until it proves impossible. It usually takes some effort up front but it’s often possible and saves time later on.
          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
          • 7231
          • 4,205 Posts
          Quote from: BobRay at Aug 27, 2008, 06:44 PM

          I generally keep trying to use a single template until it proves impossible. It usually takes some effort up front but it’s often possible and saves time later on.
          With ManagerManager you can hide certain TVs and other fields for each section (does not keep them from showing up in quickedit). But I find having TVs grouped by template helps keep things straight.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]