Search code examples
modxmodx-revolution

Calling a template variable from an output modifier in Modx?


I'm trying to output a template variable inside the if statement in ModX, but it gives no output.

I have multiple pages with links to articles and the point is to only output template variable content on the first page but not the others.

// This gives no output:
[[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=``]

// This outputs "yes" on the first page and "no" on others:
[[!#get.page:is=`1`:or:is=``:then=`yes`:else=`no`]]

I've even tried this, but it still does not give any output. I guess the problem is not about the output modifier:

[[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=`[[*content]]`]

I'm using ModX Revo 2.7.0

Any help is appreciated, thanks in advance!


Solution

  • Actually in your case missing a double closing angle bracket "]]"

    [[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=``]]