getTvDisplayName is an extra by ncrossland, first released on 2011-04-15.
New in this version:
Support TVs which use delimiters to display more than one value
Download via package management.
if you have a TV which is a checkbox or listbox, you may have specified separate labels and values such as:
For the money==1||For the show==2||To get ready==3||Go cat go==4
If you then output the value of the TV in a template using
it will output something like:
If you use this snippet as an output filter, it will instead retrieve the labels associated with the values that you have specified in your TV setup. So put in your template
it will output
To get ready
Sometimes the filter will have trouble because the TV name isn't put in the code exactly as it is setup in the manager - for example in a getResources template chunk, by default TV names are prefixed with
To work round this, you can supply the prefix to ignore as the parameter, e.g.
If a TV type allows more than one value to be selected (e.g. checkboxes, list (multi)) you should set an output option for the TV of "delimiter" which will separate the values with a delimiter of your choice, for example a comma.
This snippet will replace every value, based on the delimiter. You should ensure your delimiter isn't going to occur in your TV display options - e.g. if your TV display options contain commas, don't choose comma as your delimiter. You might want to choose an unusual character such as §.
You may want to further format the display of your TV values using other output filters such as :replace, e.g.
to display each item on a new line.
- First seen
- Supported databases
- MySQL SQL Server
- Minimum MODX Requirement
|MODX.com||1.1-pl||2011-04-15 (9 years ago)|