Hello forum!
I've developed a couple of sites in MODx now and usually things work as expected. Sometimes they don't and i usually end up making my own snippet as a workaround. This time though, i really want to know what i'm doing wrong. I've probably just mistunderstood something fundamental about placeholders and snippets but i'm prepared to be lectured.
Im doing this particular if call like this;
[[!If? &subject=`[[+totalResults]]` &operator=`GT` &operand=`0` &then=`Displaying [[+firstItem]]-[[+lastItem]] out of [[+totalResults]] total` &else=`No results`]]
No matter what totalResults is, i always get the "No results" output. The placeholders belong to getPage if that is relevant. MODx 2.2 and If 1.1 installed
Here's the result if i add &debug, used > operator in this case:
Array ( [subject] => 23 [operator] => > [operand] => 0 [then] => Showing 1-20 out of 23 total [else] => No results [debug] => 1 ) string(10) "No results"
I've also tried variations like:
[[!If? &subject=`[[+totalResults]]` &operator=`empty` &then=`...
[[!If? &subject=`[[+totalResults]]` &operator=`neq` &operand=`0` &then=`...
But these work the other way and always show the &then and never the &else.
Why izz like diz?
Update: using the placeholders uncached makes no difference, but i found that doing a var_dump on
gives me
So apparently this particular placeholder has some weird hidden characters im gona try to get rid of.
Thanks!
// Kristian
[ed. note: krills last edited this post 14 years, 8 months ago.]