ModxI am currently in the process of creating a physician directory for a larger health system site that is in redevelopment here at Pleth, LLC. As I was going through the motions of coding templates for my Ditto output I realized that with such a large number of fields per page my layout was beginning to suffer as fields were being left blank by the end user. I came across this PHx solution in the MODx forum and wanted to share it since it is a simple solution to an otherwise frustrating problem.

The basic structure I started with:

A Variable: [+avariable+]<br />

The new structure (uses backticks):

[+avariable:isnot=``:then='A Variable: [+avariable+]<br />`+]

View Comments on “Hide Empty MODx TVs in Ditto”

You can track this conversation through its atom feed.

  1. Chuck says:

    You could also use the phx snippet ifempty, then you can just do [*MYTV:ifempty=``*]

    There's also a notempty is use often so it could be [*MYTV:ifnotempty=`<img src="[**MYTV*] />`*]

    Lots of cool ways to use phx

  2. Gregory Smart says:

    Thanks, I was wondering about that the other day. It looks like you could probably use that to display a default image if no image was uploaded for a TV.

  3. Chuck says:

    You could also use the phx snippet ifempty, then you can just do [*MYTV:ifempty=``*]

    There's also a notempty is use often so it could be [*MYTV:ifnotempty=`<img src="[**MYTV*] />`*]

    Lots of cool ways to use phx

  4. Gregory Smart says:

    Thanks, I was wondering about that the other day. It looks like you could probably use that to display a default image if no image was uploaded for a TV.

Leave a Reply

You must be logged in to post a comment.

blog comments powered by Disqus