Putting TV (template variable) into chunks that show up on multiple pages?


I’ve been reading documents and old forum posts, and am still having a difficult time understanding how to do this. I’d prefer not to use the @INHERIT ability as I fear clients wouldn’t know how to nest a resource and would prefer to keep to keep it simple for them.

Here is what I am attempting, from my understanding.

page code:
[[!$intro? &name=[[*usersName]] &count=[[*messageCount]]]]

Chunk code:
Hello [[*name]], you’ve got [[*count]] mesages

Maybe it isn’t working because I did not give the TV any access to a chunk? If so, I do not know how to do that. Maybe my understanding of the code is wrong.

Use tags with a plus instead of an asterisk inside the chunk:

Hello [[+name]], you’ve got [[+count]] mesages

By passing in the value to the chunk as a property, it becomes a placeholder inside the chunk.


Thanks for the response. I got it working (it takes a while for me, I work in an open office and cannot focus). Got it working, but I am losing the template variable info when navigating unfortunately. I think I’ll have to try the @INHERIT route that Bob had mentioned in another post

EDIT: I like editing my comments so I can refer to them later, reminders for myself, and also for any other struggling newbie modx developer out there.

I’m a dingus. Here is the exact code that works for me, but also be sure to give your template variables access to the templates they need to be on.

[[*loan-officer-name]] is the name of the template variable

This goes on template website

[[!$info-chunks? &name=`[[*loan-officer-name]]`]]

This goes on the chunk

<h1 class="center-text">[[+name]]</h1>