0

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.

symlink
  • 11,984
  • 7
  • 29
  • 50

2 Answers2

1

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....

Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
  • This worked, when I explicitly set the menuindex for each resource the call worked. I also had to add sortby=`menuindex` and sortdir=`ASC` – symlink Sep 24 '13 at 18:33
0

You did not specify a standard template:

&tpl=`Section` 
Vasis
  • 2,281
  • 1
  • 16
  • 23
  • I noticed this, and edited my response. Still the resource data is in what seems like a random order. – symlink Sep 24 '13 at 17:16