Answer the question
In order to leave comments, you need to log in
How to create tv fields from a static file in modx?
Good afternoon, it’s
clear how to link snippets, chunks, etc. to static files.
But how is it done for tv fields? (couldn't find documentation)
Answer the question
In order to leave comments, you need to log in
it's not clear what you want to achieve
BobRay Reply #3, 3 years, 1 month ago
I tried creating a fairly complex static TV and I can tell you that its file contains nothing but the default value of the TV. The files for static elements are meant to hold only the 'content' of the element (eg, the text of a chunks and templates, and the code of a snippets or plugins).
Given that only the default value of the TV is saved, there's usually no point in having a TV be a static element unless its default value is a fair amount of text.
I don't think the static nature of your TVs is the problem. More likely it's a nesting/cache issue. For example, if your TV tag is inside a snippet tag that's inside a chunk and the chunk tag is in a template or another chunk, MODX can have trouble with it since the TV tag may not be parsed at the point that it's used.
Also, if the TV tag is unparsed (with a !), that delays its processing so that its value may not be available when the tag it's in is parsed.
Feel free to post a TV tag that your having trouble with.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question