I need send to Ditto parametr starId. But i cant use static Id, because i need use this code in other dirs. So i try get Id from page by they alias and parent document.
For example i use whis URL: /rootdir/articles/ on site. I get ID for this page by doing this:
<?php
// Sample usage:
// [!getDocIdInMainDirByAlias?alias=`products`!]
$langArray=$modx->getDocumentChildren(0);
foreach ($langArray as $lang) {
if ($modx->runSnippet('UltimateParent') == $lang['id']) {
$mainDirArray = $modx->getDocumentChildren($lang['id']);
foreach ($mainDirArray as $dir) {
if ($dir['alias'] == $alias)
return $dir['id'];
}
}
}
?>
It works well. Then i need Ditto to output all childrens in folder /rootdir/articles/.
I try do [!Ditto? &startID=`{{productsDirID}}`!] - where {{productsDirID}} return id of need document.
But result in page i see all code after startId.
Wrong tags?
But this code work:
{{productsDirID}}
[!Ditto? &startID=`{{productsDirID}}`!]
I cant understand why it work...
Then i try make one snippet with this code:
<?php
return $modx->runSnippet('Ditto', array(
'startId' => $modx->runSnippet('getDocIdInMainDirByAlias', array('alias' => 'articles')),
'showInMenuOnly' => '1',
'summarize' => '3',
'paginate' => '0',
'tpl' => 'atricles_main_folder'
));
?>
It dont work... "return No documents found."
Then i try change Ditto to Wayfinder - thats works well. Why not work Ditto?
Is it another way to send dynamic parameter to snippet?
Thx!