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 />`+]
  • Chuck
    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
  • 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.
blog comments powered by Disqus