Exploring MODx From the Inside: Using TV Output Widgets

Using TV Output Widgets

Template Variable Output Widgets format the TV's content for display on the final web page. These are optional; you can simply use the raw content of any TV. You can also create your own custom output "widgets" using snippets. This is my preferred way of dealing with TV output; I find the built-in widgets to be rather limited. There is an excellent article in the wiki on how to do this.

The built-in output widgets' formatting functions are in the /manager/includes/tmplvars.format.inc.php file.

The output widgets that depend on javascript use the mootools.js and the custom moodx.js libraries found in manager/media/script. A link to these libraries will be inserted into the head of the document. This can cause conflicts with other javascript libraries that you may include for your own functionality; in this case it would be better to use a snippet to provide custom TV output formatting.

The Built-in TV Output Widgets

There are 14 built-in output widgets to format the TV's content. Most of them have a list of parameters to control their output.

If no widget has been selected, the TV's value will be ouput exactly as it was entered in the input fields. If the input type was radio buttons or check boxes, their values are converted to a string with the values separated by || characters for easy custom handling.

Comment On This Article

Do you find something unclear? Did I miss something or get something wrong? What do you like or not like about this chapter? Please do not ask for help here; use the forums if you need help.


If you have trouble reading the code, click on the code itself to generate a new random code.
Security Code: