Is there a way for TV’s to be passed globally to all of my templates that use that TV?
I have a chunk which includes the TV and is used in many of my templates. If I change the TV it will only update the pages that use that template - is there anyway to get all of the other templates to automatically update as well?
I know I can change the chunk myself but some of the users aren’t at all technical and I don’t want them to access the chunk code in case they change the wrong thing!
Many thanks.
If I understand you correctly, wouldn’t that be a case of setting the Default Value in the TV?
Thanks for your response.
The TV’s value will be changed every couple of months so a default value won’t work for this unfortunately unless there is a way to use the default value to overwrite the current value (I have tested it and don’t think it does)?
One approach is using a simple chunk and these optional plugins:
PHx
http://modxcms.com/forums/index.php/topic,33316.msg238461.html#msg238461
+
UI Messages
http://modxcms.com/forums/index.php/topic,37321.msg225741.html#msg225741
PHx enables you all kinds of options. If the TV value is something show chunk, if
chunk value is something show it or not.
With the other plugin for UI Messages you could link the chunk if you want restrict
hide tabs for clients etc.
Or a binding. Like @FILE and @INHERIT
http://modxcms.com/forums/index.php/topic,34566.0.html
If I understand you correctly you want to have a value or text, which is the same on several places on your website. Ok, this is what chunks are normally for.
But you want your editor/customer can edit these contents the same way as he can edit TV-contents.
Why not creating one ressource ’site-settings’ or something like that.
Let your user modify ’global TVs’ at this document and use for example the getField-snippet to get these ’global’-Values. you can put the getField-call in your chunks, which are placed in your templates or place getField-call directly in your templates.
Or create a root folder where you put in all your present root folders/documents. Insert @inherit as standard option for the TV. So you only have to change the TV of the new root folder, all child folders and documents inherit this value.
Quote from: jj0101 at Jan 04, 2010, 06:27 AM
Is there a way for TV’s to be passed globally to all of my templates that use that TV?
I have a chunk which includes the TV and is used in many of my templates. If I change the TV it will only update the pages that use that template - is there anyway to get all of the other templates to automatically update as well?
I know I can change the chunk myself but some of the users aren’t at all technical and I don’t want them to access the chunk code in case they change the wrong thing!
Many thanks.
Maybe I’m misunderstanding you, but it sounds to me like your problem can be solved just by connecting the TV to all your templates. A TV isn’t limited to just one template.
I found my solution and it is......[[getField]] this is the global template variable solution that i was looking for.