getTvDisplayName 1.1.0-pl

getTvDisplayName 1.1.0-pl

Released Apr 15, 2011 by ncrossland

An output filter to retrieve the display value of a TV, given the stored value. For example, 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 

Download 4kb (1674 downloads)
Downloads: 1,917
License: GPLv2
Requires Revolution 2.0.x or greater
Supports mysql,sqlsrv

New in this version:

Support TVs which use delimiters to display more than one value

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.

1.1-pl

  • Support TVs which use delimiters to display more than one value

1.0-pl

  • Initial public release

Version Released Author Downloads
2 Versions 1 Contributors 1,917 Downloads
1.0.0-pl Apr, 08 2011 ncrossland 243