-
☆ A M B ☆
- 265 Posts
I sometimes found the logic of MODx the hardest thing to get my head around; but once I understood the purpose and workings of TVs, Chunks, Templates and Snippets everything clicked in my mind... I couldn’t really ever see myself using another CMS.
I’ve developed different methods over time, but I’m sure I’ve not got to the most effective template logic yet...
What I’m interested to hear is how other people organise and structure their MODx sites? When do you use a TV or a Template or a Chunk, how many Templates do you generally like to have?
One per page is sometimes necessary but overkill. I always aim to have one or two primary templates across the site, then use Chunks and TVs (and more recently ManagerManager and Form Customisations) to organise content, but sometimes things become so complex I start making more and more templates which ends up making things less flexible - how do you overcome this?
MODX Ambassador for Thailand. Managing Director at
Monogon, a web design and development studio based in Bangkok, Thailand. -
Follow me on Twitter.
-
☆ A M B ☆
- 24,524 Posts
I use one template, with several CSS files: one will be "common.css" with the common styling (header, menu, footer), then I’ll have "3column.css", "2column.css" and any others I may need, with display:none and different float and widths for the various parts that differ from page to page. These usually just address the styling of the main content area and the sidebars, but it can be more complicated if necessary.
Then I use a TV with radio buttons for the stylesheet I want to use. I’ll set the default to be the most common (usually a 2column). @INHERIT can also be useful. So the template has two links for stylesheets, one to common.css and the other to [*stylesheet*].css
I try to keep my template a simple HTML frame, or skeleton. For example, the template will have the container elements for the sidebars, but the actual sidebar blocks will be chunks. I’ll use a TV for this with checkboxes, or just a textarea TV with a bunch of chunk tags in it.
So far I don’t see any reason to deal with Revo templates any differently.
I use a different template for almost every type of page on my site. for example, all of my portfolio galleries use the same template, but my "about" page is a different template.
One css file. (not including any additional ones used by snippets)
I use chunks for almost everything that appears on more than one page like the menu.
I use more templates than I need to perhaps, but it helps me keep things organized in some ways.
I have an iphone version of my site that has it’s own unique copy of almost everything my main site has... templates, chunks, and a css file.
www.markojokic.com
My strategy is having "internal" and "external" (files) templates.
You can read about it in www.modxperience.com in the "How to create templates" article.
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
I try to put all the important stuff in chunks, so if I have multiple templates, some can still use the same chunks, and I still have to edit stuff in just one place in case things need to change. For instance, my first template for a new project might be like this:
[[$htmlHead]]
[[$masthead]]
[[$navigation]]
[[$sidebar]]
[[$mainContentArea]]
[[$footer]]
[[$googleAnalytics]]
[[$closeHtml]]
Then I just reuse a lot of those chunks, or use TVs within the chunks for altering/creating new templates.
Hi,
It’s very interesting to see so many different approaches. This shows the enormous flexibility of MODx!
My approach to templates is to have a nice small number of them. Typically at least a home template and a secondary one. Usually One CSS file. For color and style variations, I use TV’s to override my CSS, so from one template you can get loads of color and style combos. The TV’s could be plain text boxes if it’s me filling them in, or maybe radio buttons with choices for the client.
For even more OCD-ish control, I might copy and rename the secondary template and class the BODY or other part, then you have even more variations. And lately I’ve been taking more advantage of Link Attributes, which will allow me to style each link in a menu differently, or have a different background image, and so on, adding extra specificity to the amazing Wayfinder.
Usually the only time I end up with many templates is for a site with really crazy menu stuff, like different styling and menus on every document level. I might just have the regular template with a different Wayfinder call. But even those calls could be pulled in with TV’s and/or chunks, keeping the template the same if desired.
Then I just use a few chunks for footer, maybe header, and for any other gewgahs needed. With all that, no matter how insane the design is, it can be built with MODx. Other systems it would be impossible, or 3 times the work. I rarely need PHx, but that’s there if you need it... I’m going to have to work out how that is done in Revo, I’ll take that up soon.
Cheers, Dave