Search code examples
modxmodx-evolution

MODx: Checkbox using tv to output result in a chunk


Using Evo 1.0.6

I have made a TV with single select Yes No and assigned it to a template. If admin selects Yes, the resource's longtitle should be output to a chunk. None if selected No.

For example, I would like to have a checkbox while adding a resource which says "List this page as popular". Which if checked displays the resource's longtitle in a chunk in a list, like

Chunk output:

<h3>Popular Pages</h3>
<ul>
<li><a href="[*id*]">[*longtitle*]</a></li>
</ul>

Solution

  • In the TV Input Option Values, add this:

    Yes=={{nameOfChunk}}
    

    Then when the checkbox is selected, the chunk will be displayed wherever your TV tag appears in your templates.