Hi everyone,
Let me start by saying that I’ve been an enormous MODx supporter and daily user for about two years, and one of the big reasons is that I recognize the power and flexibility of template variables. However, there’s one area where I think they’re quite limiting (or maybe I’m missing something obvious?). Let me see if I can explain.
Let’s say I have a page where I want my backend user to be able to enter multiple blocks of similarly categorized and styled content. For example, maybe this is a catalog site where I want the user to be add several blocks of this code:
<div class="catalogitem_block">
<h2 class="catalogitem_title">Title</h2>
<div class="catalogitem_content">
Content
</div>
</div>
To make this work, I could do one of three things:
- The first is to create a template, create template variables for the h2 and content and tie them to this template, and then use Ditto to pull in the content on a sort of "parent" page.
- The second is to just put in a WYSIWYG editor on the parent page and let them enter content free-form, without having to create the TVs and child pages.
- The third is to create a TON of TVs, assuming I know how many h2s and content blocks there are going to be, and assign them all to the parent page, but this isn’t practical in most situations.
Wouldn’t it be easier to just have a TV type that let my backend users click a button on the parent page that said "add block" or something similar, and doing so created a new, blank set of TVs? In the template, the TV call would then just output sequentially however many code blocks were entered?
I know this may be a bit beyond the current intent of TVs and steps away from the "every block of content is its own page in the hierarchy" mantra that works pretty well in most cases, but I see this as being a much more commonsense and powerful way for adding repetitive content to a single page (table data in particular comes to mind), especially when you consider how heavily the AJAX nature of the MODx backend is touted. Or maybe there is already a way to do this that I haven’t considered?