So Im new to modx still.
Im building my first website. I have multiple templates. What I want do is this here:
I want to have a field somewhere, where the client can write in the adress and then all templates should be updated with that variable.
Do I need to build a new resource for that?
Or can I add a sort of template variable that is able to change all template variables?
Or are there other much easier ways to get there?
If you have reoccuring content which should be the same across multiple resources you can use a Chunk. Create a new chunk and add the chunk placeholder
[[$yourchunkname]] within the templates you want this content to appear.
If you want the content of this chunk to be adjustable by your client, you have to use a TV (Template Variable) which gets placed within your chunk. Because TVs are resource specific you can’t just use the general placeholder
[[*yourtvname]] as it would only show the values entered for the current resource.
However you can assign the TV to the template of a resource, let’s say your “Home” resource and reference that resource by using the fastField tag within your chunk. If your homepage has resource ID 1 it would look something like this:
[[#1.yourtvname]]. This will now fetch the data from your TV but always take the values entered in the “Home” resource.
In general I would highly recommend investing some time in understanding how the following are used and what their functions are which will unlock the full MODX flexibility for you:
Hope this helps!
Thanks a lot, that definitely helps and I will look into the docs you refered to!