Content Blocks - how to walk around limitations?

Hi to all,

Coming from Typo3 / TemplaVoila! I am new to ModX and Content Blocks. Please excuse me, if I ask some stupid newbie questions.

How do I use chunks with TVs from inside Content Blocks? I only found 4 Input Fields in Content Blocks while there are much more (around 18) for Template Variables. Overall I feel quite lost. Some examples in the documentation might provide some help.

Repeater look a great and easy to use Tool. Two thinks I could not find out jet:

  1. How do I pass a value to the OUTER template?
  2. I’d like to use a select input field. But the standard input fields don’t seem to be available.

Best Regards
Bernd

Hi Bernd,

Welcome to MODX :smiley:

ContentBlocks ships with 21 different input types, which should cover the vast majority of the types of content you use. If you go to Extras > ContentBlocks, you can create new Fields with those input types - they’re not all available in the standard set of fields.

On https://www.modmore.com/extras/contentblocks/documentation/input-types/ you can find a brief description of most of them, and the more complex ones like the Repeater have their own docs at https://www.modmore.com/extras/contentblocks/input-types/. We definitely need to work on providing better documentation for each of the input types, but with those two pages and the descriptions within the manager, most of them are fairly easy to understand.

You might also find our demo site at http://demo.modmore.com/manager/?a=resource/update&id=1 interesting - that showcases a “real life” set of fields and layouts and how they can work together in building a page.

Typically, when you use ContentBlocks there is suddenly a much lesser need for Template Variables. The content is all in the content, and TVs are only used for meta data about the page (author, open graph images, SEO stuff etc). If you store some information in a TV, and want that information in the content as well, you can of course use the [[*tvname]] tags anywhere (in a text field, or in the template of a field or layout).

As for your specific questions about the Repeater:

  1. What sort of data do you want to pass to the outer template? There’s [[+total]] and [[+rows]] placeholders, and if you have field settings those would be under [[+settings.setting_key]].
  2. For a select field you can use this one by Ben Butler: https://github.com/bennyb/cb.classSelectInput At some point we’ll probably add one to the ContentBlocks core, but as there’s already one available we’ve been focusing on other items on the to do list :smile:

I hope that clarifies things a bit… there’s no denying ContentBlocks can be a bit complex to fully grasp the first time, but I’m sure you’ll be comfortable with how it works in no time!

Many thanks for your quick reply. It really got me started.

I could not find the variables [[+total]] or [[+settings.setting_key]] in the documentation. Is there a way to find out about them I should know?

One more question pops into my mind. Does the repeater have a variable like [[+current]]?
I’d like know which row out of. let’s say 10 rows, is currently processed.

This might be useful to start (and finish) a new row within a bootstrap grid.

Glad to hear :smile:

Whenever you hover over the template fields in the manager that will show the placeholders for that template. It looks like the [[+total]] and [[+idx]] placeholders were missing from the descriptions, so I’ve just added those to be included in the next release.

The [[+settings.setting_key]] depends on the field settings you may have set up - if you don’t have any, that wont be available.

One more question pops into my mind. Does the repeater have a variable like [[+current]]?

That would be [[+idx]]