MODX Revo getChildIds选项

问题描述 投票:1回答:1

这种方法有哪些$options参数?

array getChildIds ([integer $id = null], [integer $depth = 10], [array $options = array()])

我正在寻找一种让孩子的别名不是“f”的所有孩子(深度= 3)的方法。

modx modx-revolution
1个回答
3
投票

用这个:

<?php
$id = 123;
$depth = 3;

$ids = $modx->getChildIds($id, $depth);
$docs = $modx->getCollection('modResource', array(
    'id:IN' => $ids
    ,'alias:!=' => 'f'
));
$output = '';
foreach ($docs as $doc) {
    $output .= $doc->get('pagetitle') . '<br/>';
}

return $output;
© www.soinside.com 2019 - 2024. All rights reserved.