Подчет дочерних документов

Здравствуйте!

Структура документов:



[[!pdoMenu? &parents=`5`  &displayStart=`1` &countChildren=`1` &fastMode=`1` &scheme1=`uri` &level=`2` 
                    &tplOuter=`@INLINE <ul class="gallery-cats clearfix">[[+wrapper]]</ul>` 
                    &tplInner=`@INLINE [[+wrapper]]`
                    &tplStart=`@INLINE <li[[+classes]]><a href="{{~5}}">Minden </a> ([[+children]])</li>[[+wrapper]]`
                    &tpl=`@INLINE <li[[+classes]]><a href="{{~5}}?year={{+alias}}">{{+pagetitle}}</a> ([[+children]])</li>`
                    &showLog=`0` &firstClass=`` &lastClass=`` &hideContainers=`0`
                ]]
Результат вывода (подсчет документов вместе с контейнерами):



Подскажите пожалуйста, как подсчитать дочерние документы без контейнеров?

При установке параметра &where =`{«isfolder»:«0»}` или &hideContainers=`1` выводится результат с большим количеством записей: Minden (0)Minden (0)Minden (0)Minden (0)…

Заранее спасибо.
Антон Грошев
06 ноября 2017, 14:16
modx.pro
1 085
0

Комментарии: 3

Pavel Zarubin
07 ноября 2017, 15:48
0
del
    Антон Грошев
    09 ноября 2017, 02:13
    1
    0
    Решил таким методом:

    {var $par =  $modx->runSnippet('pdoResources', ['parents' => 5,'limit' => 0,'returnIds' => 1,'fastMode' => 1,'scheme' => 'uri','level' => 1,'depth' => 0]) | split}
    {set $cnt = $modx->getCount('modResource', ['parent:IN' => $par ])}
    {'pdoMenu' | snippet : [
    'parents' => 5, 'displayStart' => 1, 'countChildren' => 1, 'fastMode' => 1, 'scheme'=> 'uri', 'level' => 2,
    'showLog' => 0,  'firstClass' => '', 'lastClass' => '',  'hideContainers' => 0,  'parentClass' => 0,
    'tplOuter' => '@INLINE <ul class="gallery-cats clearfix">[[+wrapper]]</ul>', 
    'tplInner' => '@INLINE [[+wrapper]]',
    'tplStart' => '@INLINE <li[[+classes]]><a href="{{~5}}">Minden </a> ('~ $cnt ~')</li>[[+wrapper]]',
    'tpl' => '@INLINE <li[[+classes]]><a href="{{~5}}?year={$alias}">{$pagetitle}</a> ([[+children]])</li>'
    ]}
      Антон Грошев
      10 декабря 2017, 23:08
      0
      или можно еще другим способом:

      {'pdoMenu' | snippet : [
       'parents' => 5, 'displayStart' => 1, 'countChildren' => 1, 'fastMode' => 1, 'scheme'=> 'uri', 'level' => 2,
       'showLog' => 0,  'firstClass' => '', 'lastClass' => '',  'hideContainers' => 0,  'parentClass' => 0,
       'tplOuter' => '@INLINE <ul class="gallery-cats clearfix">[[+wrapper]]</ul>', 
       'tplInner' => '@INLINE [[+wrapper]]',
       'tplStart' => '@INLINE <li[[+classes]]><a href="{{~5}}">Minden</a> ('~ $modx->getCount('modResource', ['parent:IN' => $_modx->getChildIds(5) ]) ~')</li>[[+wrapper]]',
       'tpl' => '@INLINE <li[[+classes]]><a href="{{~5}}?year={$alias}">{$pagetitle}</a> ([[+children]])</li>'
      ]}

      может кому это пригодится.
      хотя знаю, что можно сделать через SQL селекты с подчетом дочерних документов.
        Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
        3