We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37242 ☆ A M B ☆
    • 339 Posts
    Hi dear modx people,

    i am curently struggling with a getResources Call -or all my getResources calls. If i enter the parameter &parents=`someID`, I get no output, no error, nothing. I have to call every single resource via &resources=`1,2,3,4`

    I already postet this to http://tracker.modx.com/issues/8158 - buf as i need to finish this site, i would really appreciate your help on this one.

    If I add &debug=`true` to the call, i get the following entries in the modx error log:
    [2012-06-24 15:41:59] (ERROR @ /index.php) context for 15 is web
    [2012-06-24 15:41:59] (ERROR @ /index.php) SELECT `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, IFNULL(tvSort.value, tvDefault.default_text) AS sortTV FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvars` `tvDefault` ON `tvDefault`.`name` = 'date' LEFT JOIN `modx_site_tmplvar_contentvalues` `tvSort` ON ( tvSort.contentid = modResource.id AND tvSort.tmplvarid = tvDefault.id ) WHERE ( ( modResource.parent IN (15,16,25,26) AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 AND `modResource`.`hidemenu` = 0 ) AND `modResource`.`id` NOT IN (25) ) ORDER BY sortTV DESC, publishedon DESC LIMIT 5

    My entire call is this:
    [[!getResources? &parents=`15` &resources=`-25` &limit=`5` &depth=`2` &sortbyTV=`date` &sortdirTV=`DESC` &includeTVs=`true` &tpl=`eventsRowTpl` &debug=`true`]]

    I'd be glad for any hint!

    Guido
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Are they set to show in the menu?

      (Hint, if the parent you specify is an ArticlesContainer, the individual articles are set to be hidden in the menu)
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 37242 ☆ A M B ☆
        • 339 Posts
        Well - they show up when naming their IDs in the &resources parameter, but I'll check.
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          When specifying it in the &resources, it's not checking them for the hidemenu option.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 37242 ☆ A M B ☆
            • 339 Posts
            They were currently hidden from menu and not published. I tried all combinations in the meantime - no change.
              • 37242 ☆ A M B ☆
              • 339 Posts
              Ok - it seemt like they have to be published but not hidden from the menu to be grabbed by &parents parameter. One of the things that dont fit my brain, but that is how modx works sometimes smiley

              Mark - one again - thank you!
                • 18373 ☆ A M B ☆
                • 3,141 Posts
                It's real simple.

                Not published = not visible for site user, the core takes care of that.
                Hidden from menu is a flag that doesn't do anything in the core, but is used by extras like Wayfinder and getResources to see if resources need to show up or not.

                Those extras offer configuration possibilities called snippet properties to change how they work. If you look at the docs for getResources at http://rtfm.modx.com/display/ADDON/getResources, you will see this:
                showHidden If true, will show Resources regardless if they are hidden from the menus. Default: 0

                In other words.

                Specify &showHidden=`1` if you don't want it to look at the hidden from menu flag and just include all of 'm.
                  Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                  Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                  • 37242 ☆ A M B ☆
                  • 339 Posts
                  Well... its simple unless you expect it to act the same way with the same properties smiley

                  Besides: in that case, resources show up if addressed via &resources - regardless of &showHidden. either way - its not straight and its confusing.
                    • 18373 ☆ A M B ☆
                    • 3,141 Posts
                    I don't find it confusing personally, as &resources is used to specifically pinpoint (in essence, hardcode them) the resources you want to see listed. &parents is used to generate a listing of children of a specific resource, so you are in that case not specifically telling which individual resources. It's two different properties with their own behavior.

                    If you have suggestions on improving the docs or the snippet, make sure to file it in the proper tracker.
                      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                      • 37242 ☆ A M B ☆
                      • 339 Posts
                      I would never file it anywhere. There is too much places where one can search for help / file bugs & issues. I dont want to file ich four times until I hit the right channel.

                      I already wrote it down three times, that should be sufficient.

                      Tere are so many good wed guys in the modx team and yet they didnt manage to get a reliable and intuitive community platform running. Its a shame sad