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
If you can dream it, you can do it.
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.
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.