0

getResources を使用して、ドキュメントとその子ドキュメントからコンテンツを取得したいと考えています。以前&depthはこれができたと思いますが、うまく機能しないようです。

私は2つのアプローチを試しました:

echo "[[!getResources?  $parents=`15`  &includeTVs=`1` &resources=`" . $resid . "` &depth=`1` &tpl=`tendertmp`]]";

と:

echo "[[!getResources? $parents=`" . $resid . "` &depth=`1` &includeTVs=`1` &tpl=`tendertmp`]]";

$residは、スニペットによって生成された単なる数値です。最初の例は、深さがなくても問題なく機能します。

深さを使用する正しい方法や、リソースのコンテンツとその子リソースのコンテンツを取得する方法を知っている人はいますか?

4

2 に答える 2

4

なぜhttp://rtfm.modx.com/display/revolution20/modX.runSnippetを使用しないのですか?

$output = $modx->runSnippet('getResources',array(
   'parents' => $resid,
   'depth' => '1',
   'includeTVs' => '1',
   'tpl' => 'tendertmp'
));
echo $output;

$parents代わりにの 2 番目の間違い&parents

于 2013-06-17T02:39:23.017 に答える
0

PHP スニペット内から getResources を実行しようとしている理由が実際にはわかりません。そうする理由はほとんどありません。

$modx->getCollection('modResource, $someCriteriaHere); またはを簡単に実行できます

ページから getResources を直接呼び出します。

[[!getResources?parents=`15`&includeTVs=`1`&depth=`1`&tpl=`tendertmp`]]
于 2013-06-21T10:12:22.193 に答える