I feel like I’m doing it wrong. lol I have a site I’m working on that has several pages that are basically the same but have some minor differences, like a different background-image on the header. Also, the content is arranged a little different and there are parts of it that need to go in specific places, which means I’m creating the layout by floating DIVs and such. What I’m winding up doing is creating a new template for each of these pages but I can’t help but think that there’s a better way to do it than that. I feel like a TV could probably solve the issue with the different background images but I don’t know how. As for the content, because of the markup surrounding it I can’t just pull it all in with the [*content*] placeholder. I could if I turned off TinyMCE and put the all the markup in the document but that gives the content editors the ability to break the layout. My solution has been to put the layout in the template and use chunks for each of the different content areas but it just feels like such a hack. There’s gotta be a better way... doesn’t there?
Dave
Dave,
Good question! I think this is one of those "many ways to do the same thing within MODx" kind of scenarios.
I don’t think its awful having a few templates to run a site. However if each page is radically different then your site design might not have a cohesive "look" overall.
You have unique templates, chunks, and TV’s to work with here. You can use them independently or as a combined system. Your specific site will dictate the best approach though. I would look at all your pages and set about using all the common elements in the master template. Try to use chunks for blocks of straight html that gets used repeatedly. Even the <head> code can be presented with a chunk. Doing so presents nice options as you can deploy different variations of CSS.
Check out TV’s for presenting options for inserting page elements when you create new pages from the Manager. Its a very powerful tool once you get some of the basic options down.
Posting a URL to a live sample can help others pinpoint more detailed options for you. Quite often deploying a template means stripping and bending a static page design and creating the template from that exercise. After a couple of MODx sites you start to think about the template and its functionality within MODx BEFORE designing the page system. This takes some extra thought and planning beforehand but once up and running creating pages becomes a snappy time saving process.
Hope this helps. I know this sounds a little vague. But I find if I slow down and look at my template code with an eye to stripping out stuff (usually content) that does not need to be there the better the template system works.
Max
Thanks for the advice Max. I do use chunks to reproduce all of my footer and header/navigation code in each template. I probably shouldn’t have used the word header in my original post when I was talking about it being different from page to page. What it really is is a banner with a graphic about that particular section of the site. I can’t link you right now because the site isn’t live yet but when it is I will and I would love to hear suggestions on different approaches to creating a site like this with as little code duplication and as much content editability as possible.
Dave