Question

I'm having trouble with my getResources call. It should start at the top of the menu, and display each direct child. Here's the call:

[[!getResources? 
&parents=`1`
&depth=`depth`
&limit=`0`
&tpl=`Home` 
&tpl_2=`Section2` 
&tpl_3=`Section3` 
&tpl_4=`Section4` 
&tpl_5=`Section5` 
&tpl_6=`Section6` 
&tpl_7=`Section7`  
&includeTVs=`1` 
&processTVs=`1` 
&includeContent=`1`
]]

It displays every resource other than the first correctly, but the first resource uses the right template but pulls from the wrong resource (resource 6, the first child that has children.

Update: It appears now that its displaying the array of info for resource 1 last. Still don't know why it's doing this at all.

Was it helpful?

Solution

Very strange behavior.. you might try:

  • &tplFirst=Home
  • &depth should be an integer, unlikely, but could cause problems
  • check to make sure your first resource is published and not hidden

by default I believe getResources sorts on menuindex - check your indexes [or specify a sort order explicitly - you can't always trust the order resources appear in the resource browser, it may be cached or set to not update on save]

Kind of looks like you are trying to build a menu/navigation, WayFinder will not work for you?

and as always, always-always clear the modx cache....

OTHER TIPS

You did not specify a standard template:

&tpl=`Section` 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top