• MODX.com

    1,850 downloads

getTvDisplayName

getTvDisplayName is an extra by ncrossland, first released on 2011-04-15.

Package Description

New in this version:

Support TVs which use delimiters to display more than one value

Usage/Installation Instructions

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 

   [[*elvis]]

it will output something like:

   3

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

  [[*elvis:getTvDisplayName]]

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 

  tv.

To work round this, you can supply the prefix to ignore as the parameter, e.g.

  [[+elvis:getTvDisplayName=`tv.`]]

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.

  [[+elvis:getTvDisplayName=`tv.`:replace=`,==<br/>`]]

to display each item on a new line.

Details

Developer(s)
ncrossland
Released
2011-04-15
First seen
2011-04-15
License
GPLv2
Supported databases
MySQL SQL Server
Minimum MODX Requirement
2

getTvDisplayName Releases

Vendor Signature Released on
MODX.com 1.1-pl 2011-04-15 (7 years ago)