<![CDATA[ getPage: Property &totalVar and Output filter - My Forums]]> https://forums.modx.com/thread/?thread=96918 <![CDATA[getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524359
this getPage call
[[!getPage@fooPropertySet? 
	&element=`migxLoopCollection` 
	&packageName=`foo` 
	&classname=`Foo` 
	&tpl=`theRowTpl`
	&limit=`20`
	&totalVar=`itemsTotal`
]]
allows to output the total number of items using the tag [[+itemsTotal]].
But in case there are no items found, instead of 0 the output is empty.

Trying the output filter
[[+itemsTotal:is=``:then=`0`]]
I always get the output 0, whatever be the value.

What am I missing?


]]>
ottogal Apr 14, 2015, 02:52 PM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524359
<![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-558430 archimedes May 08, 2018, 03:31 PM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-558430 <![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524501
[[+itemsTotal:is=`0`:then=`null`:else=`[[+itemsTotal]]`]]
The output is, in any case, the same as for
[[+itemsTotal]]
]]>
ottogal Apr 17, 2015, 01:39 AM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524501
<![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524452 For $modx->getPlaceholder($placeholder) I always get an empty string.
It seems that the &totalVar property is not handled like other properties.
]]>
ottogal Apr 16, 2015, 06:40 AM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524452
<![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524451
xPDO::getCount(), which is used internally, does allways return an integer, not an empty string.

you can try to change the &totalVar to something different

you can try, if you get something with:

[[+itemsTotal:is=`0`:then=`null`:else=`[[+itemsTotal]]`]]


(perhaps the value is 0, but gets removed somehow)

]]>
Bruno17 Apr 16, 2015, 06:36 AM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524451
<![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524450 ottogal Apr 16, 2015, 05:57 AM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524450 <![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524449 Can you test, what you get with that, what I posted earlier?

[[!getPage?
&element=`migxLoopCollection`
&classname=`modResource`
&limit=`20`
&totalVar=`itemsTotal`
&tpl=`@CODE:[[+pagetitle]]<br>`
&where=`{"parent":"99999"}`
]]
 
[[+itemsTotal]]


]]>
Bruno17 Apr 16, 2015, 05:14 AM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter?page=2#dis-post-524449
<![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter#dis-post-524446
There's a &where property too in my call, working well. In case there are no items matching the criteria,
the output of [[+itemsTotal]] is empty, not 0.
Type casting did not help, and Output filters are not working.
What else could I try?]]>
ottogal Apr 16, 2015, 04:49 AM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter#dis-post-524446
<![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter#dis-post-524441 So, if you delete the articles-extra, this might also delete the extras which are included with the articles-package.]]> Bruno17 Apr 16, 2015, 02:58 AM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter#dis-post-524441 <![CDATA[Re: getPage: Property &totalVar and Output filter]]> https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter#dis-post-524440
But there remains the mystery how it could disappear.
The only action I performed these days was deleting the Articles Extra. Is it imaginable that this was deleting getPage too?
(If so, there should be a warning of such an unwanted side effect.)]]>
ottogal Apr 16, 2015, 02:48 AM https://forums.modx.com/thread/96918/getpage-property-totalvar-and-output-filter#dis-post-524440