-
- 45 Posts
Hi BobRay,
I call a snippet, that only contains "echo $modx->context->key;", from a chunk that then only selects the resources of the returned context. If i exchange the "echo $modx->context->key;" in the snippet for you suggestion "$modx->context->get('key');" it doesnt return the context name it seems... i get ALL resources.
Would like to understand how you meen i should use this and why it is more correct?
Thx again!
[[!getResources?
&context=`[[!sptGetContextName]]`
&limit=`0`
&parents=`0`
&sortby=`{"menuindex":"ASC"}`
&tpl=`chkDisplayFrontBtn`
&tplFirst=`chkCreatePageSkip`
]]
____________________________________________________
-
- 45 Posts
Hi BobRay,
I call the snippet that returns the context name (with my string above) from a chunk to select only the resources of that context. If i place your line ($modx->context->get('key');instead of mine in the snippet i get all resources, seems your line does'nt return the context-name.
How can this be, or have i miss understood something?
[[!getResources?
&context=`[[!sptGetContextName]]`
&limit=`0`
&parents=`0`
&sortby=`{"menuindex":"ASC"}`
&tpl=`chkDisplayFrontBtn`
&tplFirst=`chkCreatePageSkip`
]]
____________________________________________________
-
- 24,544 Posts
Sorry, I should have written:
return $modx->context->get('key);
---------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . .
MODX info for everyone:
http://bobsguides.com/modx.html
-
- 45 Posts
Yea, that works better, thx BobRay (have your
book here, great stuff! (i should read it some day ;-)
____________________________________________________
@adanyc if you did this I suggest you undo it and just use my
context router method and your issues will be fixed, when you use Context Router you don't need to do anything besides creating Context Settings so steps 1-6 are not needed.
This might be why you are having issues.