GetResources - Issue

I have a family tree as below;

  • Home (Published) (ID:1)
  • News (Published) (ID:2)
  • Main Competition Page (Published) (ID:3)
    *** List of Competitions (Published & Hidden from Menu) (ID:5)
    ****** Competition One (Published) (ID:6)
    ****** Competition Two (Published) (ID:7)
    ****** Competition Three (Published) (ID:8)
  • Contact Us (Published) (ID:4)

I have a GetResources calls on the Main Competition page. The Main Competition page is Published as it has more information on it other than just the list of Competitions.

I have hidden the List of Competitions page because I don’t want them to be public to the outside world but also published so a client can see it when I send the link.

I have the three competitions inside the List of Competitions folder published also as I thought if the folder was hidden, the inner child pages wouldn’t be visible also.

My GetResources call on Main Competition page;

[[!getResources?
  &parents=`5`
  &depth=`1`
  &limit=`0`
  &tpl=`name_of_template`
  &includeTVs=`1`
  &processTVs=`1`
  &showHidden=`0`
  &sortby=`menuindex`
  &sortdir=`ASC`
]] 

Even though I have &showHidden=0, on the GetResources they are still visible on the main competition page. Am I doing something wrong?

I don’t think so. This should work.

Maybe try adding the property &debug=`1`. It should then output the SQL query to the MODX error log.
Is there a condition `modResource`.`hidemenu` = 0 in the SQL query?

I wasn’t sure if my explanation was right. I have edited my text. Does it make sense now?

It sounds like only “List of Competitions” (#5) is marked as hidden from menus, so while that will avoid the subpages of entering a multi-level menu (i.e. Wayfinder/pdoMenu), that doesn’t hide the individual competition pages when requesting its child resources.

If you don’t want those child resources listed, set them to be hidden from menus as well.

But I am confused, if you don’t want them listed, what’s the getResources call meant to list?

See…these competitions aren’t to be visible throughout the year. Only at a certain time of year. So they will be Hidden when not needed.

I thought I’d be able to hide just the parent folder and then the child pages wouldn’t be visible either but I’m wrong.

Is there a way to hide the parent folder and in doing so, all pages inside would not show in a getResource call? Like it would in Wayfinder.

The things that’s confusing is you’re on one hand trying to list the competitions (which are all published and shown in menu according to your tree), but then say you don’t want to list the competitions.

If you don’t want to list the competitions, remove the getResources call that lists them.

Or if you do want to list them, but just not all of them, mark them as hidden from menus (or use the publishing dates to (un)publish them based on time.

+1 for what Mark said. Unless I’m misunderstanding your use case, setting them to show in menus, then unplubishing them and adding a publication date for when they should show up will make your life a lot easier.

It’s also more secure, because if someone can guess the URL, they can view pages that are hidden from menus, but not unpublished pages.

Thanks Bob…makes sense. More sense than I was making.

1 Like