Output Modifiers Not Working

I’m stumped.

I have, for example, a placeholder called landing.email. If I place [[+landing.email]] in a template, it will print out the value without any issue, so I know the placeholder holds a value.

However, if I test to see if the placeholder exists, as shown below, the test will fail. What am I doing wrong?

[[+landing.email:isnot=``:then=`
									<li class="mb-1"><i class="far fa-envelope text-color-primary"></i><p class="m-0"><a class="text-color-light" href="mailto:[[+landing.email]]">[[+landing.email]]</a></p></li>
`]]

I’d suggest trying this instead (install the If snippet if you haven’t already):

[[If?
   &subject=`[[+landing.email]]`
   &operator=`notempty`
   &then=`<li class="mb-1"><i class="far fa-envelope text-color-primary"></i><p class="m-0"><a class="text-color-light" href="mailto:[[+landing.email]]">[[+landing.email]]</a></p></li>`
   &else=``
]]

Thank you. I’ll give that a try.

hmmm, that did not work either, but I appreciate the suggestion.

What version of MODX are you using? I think some earlier versions of 3.x had an issue with colons : within output modifier tags - like your mailto:

Add the debug property as shown above to see if the subject is getting through to the snippet.

Array ( [subject] => info@porterco.org [operator] => notempty [operand] => [then] =>* info@porterco.org
[else] => [debug] => 1 ) string(0) “”

But when I turn off debug, the email address does not show.

That’s really odd. What happens if you use:

&then=`<span>WTF</span>`

Still nothing shows. It’s the oddest thing. I may have to pass all the placeholders to a snippet and build my footer that way.

Is this code nested within other output modifiers or other MODX tags?

Sometimes when these things are nested down too many levels it starts to break down.

No, each is independent. Just checking to see if a variable is populated and if not, don’t display that line.

I resolved my issue. If I call my placeholders uncached everything works. The example below works perfectly:

[[!+landing.email:isnot=``:then=`…

1 Like

I’m glad, you got it solved.
I was just about to ask, if the placeholder was set by an uncached snippet.

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.