The Wayfinder option sounds interesting (also the other one, but that seems way too complex...), just tried it bc I'm curious if it works...but, it didn't =)...
first I tried the following (while hoping, that Wayfinder can parse the &xTpl properties directly = without giving it a chunk, like the nice @INLINE feature of getResources...)
@EVAL $output = $modx->runSnippet('Wayfinder',array('contexts'=>'web','startId'=>'0','level'=>'0','ignoreHidden'=>'1','removeNewLines'=>'1','textOfLinks'=>'pagetitle','outerTpl'=>'[[+wf.wrapper]]','rowTpl'=>'||[[indent? &id=`[[+wf.docid]]` &indentstring=` `]][[+wf.linktext]]([[+wf.docid]])==[[+wf.docid]][[+wf.wrapper]]','sortBy'=>'menuindex','sortOrder'=>'ASC'); return 'Ressource wählen==' . $output;
but no output in the Select box (only the hardcoded String...but no $output added...like it's empty or not processed
then I tried to pack the &xTpl property-contents in seperate chunks, to make it just as similar to a "normal" navigation wayfinder call
@EVAL $output = $modx->runSnippet('Wayfinder',array('contexts'=>'web','startId'=>'0','level'=>'0','ignoreHidden'=>'1','removeNewLines'=>'1','textOfLinks'=>'pagetitle','outerTpl'=>'rsrcListTVouterTpl','rowTpl'=>'rsrcListTVrowTpl','sortBy'=>'menuindex','sortOrder'=>'ASC')); return 'Ressource wählen==' . $output;
// while the content of the chunk rsrcListTVrowTpl is
||[[indent? &id=`[[+wf.docid]]` &indentstring=` `]][[+wf.linktext]]([[+wf.docid]])==[[+wf.docid]][[+wf.wrapper]]
// and the one of the chunk rsrcListTVouterTpl is just
[[+wf.wrapper]]
but that also did not give me any output, still empty select box like seen on the following screenshot...
The "indent" snippet is based on Brunos code further down, way better than my initial idea which I edited out (so thanks again to him!!!)... the code for the snippet is the following:
// snippet "indent"
// @param id: the current resource id
// @param indentstring: string which should be used for indenting according to the level in the document tree...defaults to a "-" per level
$settings =& $scriptProperties;
$parentids = $modx->getParentIds($id, 10, array('context' => 'web'));
$indentstring = isset($settings['indentstring']) ? $settings['indentstring'] : '-';
$output = '';
$i=0;
foreach($parentids as $parentid){
if ($i>0){
$output .= $indentstring;
}
$i++;
}
return $output;
Then (in my desperation) I added
to the call, but that just showed me the following in the select box (noting in error log or somewhere else...so that wasn't very helpful...on the other side that's definitely not what's wayfinder made for, so I cannot blame it to not be helpful in this situation =D):
the "funny" thing about that is, that this happens in both cases (when the templates are given directly into the params or given by chunk)...so that doesn't seem to make a difference here...I tried the same in the (following) frontend experiment and there it failed miserably...so I conclude, that giving pure HTML to the &xTpl properties of Wayfinder doesn't work ie. no @INLINE capability.
Possibly this is also the reason that no output is generated?? Maybe the chunks are not processed ? But if this is the case, why is there only one entry and the subentry chunk shown in the select list, shouldn't there be more because Wayfinder would fetch all resources, but could just not parse them right...I don't get it...
After not being successful at all I tried to just make a normal Wayfinder call in the frontend of the site (like if I want to build a navigation):
[[!Wayfinder?
&startId=`0`
&level=`0`
&ignoreHidden=`1`
&removeNewLines=`1`
&outerTpl=`rsrcListTVouterTpl`
&rowTpl=`rsrcListTVrowTpl`
&textOfLinks=`pagetitle`
&sortBy=`menuindex`
&sortOrder=`ASC`
]]
so that's exactly what I tried to do in the @EVAL code (same parameters) and on the frontend this seems to generate exactly what I need:
||News(1)==1|| A second level resource(52)==52||Another Resource(51)==51||ResourceX(53)==53||Another one(3)==3
but in the backend it does not seem to do that^^...I don't see the reason why it's not giving me any output...so that's how far I came...any idea what I'm doing wrong?
[ed. note: exside last edited this post 11 years, 6 months ago.]