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.
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!!!