<![CDATA[ getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included - My Forums]]> https://forums.modx.com/thread/?thread=102530 <![CDATA[getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552395
I'm getting zero/zilch/nothing in return from a getResources call on a completely fresh install - getResources is the only extra in place (TinyMCE aside) and I'm pretty sure I've got my getResources call etc set up correctly. I've tried the call both cached and uncached.

There are 3 pages at root level in the document tree and they're all using the default MODX template as it stands. All pages load fine.

Straight away after installing and testing getResources I got error logs, but there were none with the fresh install.

I'm wondering if this is an inherent server config issue - I'm running on a TSO Host VPS/CPanel setup. I've never had any issues with TSO before but that was always on their Cloud/shared servers, never a VPS.

I'm reaching the server via my hostfile - it's not got any domain name DNS pointing at it at this stage. I can't imagine that would affect getResources but add it for completion.

Here's the setup:
MODX Revolution: 2.5.7-pl (traditional)
PHP Version: 5.6.30
MySQL Client API version: mysqlnd 5.0.11-dev (from phpinfo file)
Database client version: libmysql - 5.1.73 (from phpMyAdmin)
Server version: 5.6.35 - MySQL Community Server (GPL) (from phpMyAdmin)
Protocol version: 10
cPanel & WHM 64.0 (build 30)

The getResources call:
[[getResources? &showHidden=`1` &tpl=`pagesTpl` &debug=`1`]]

Content of pagesTpl:
[[*pagetitle]]
Fluffed Up Beyond All Recognition

Here's the MODX error log (I replaced the actual server name with 'servername'):
[2017-07-11 10:12:33] (ERROR @ /home/servername/public_html/core/cache/includes/elements/modsnippet/1.include.cache.php : 201) context for 1 is web
[2017-07-11 10:12:33] (ERROR @ /home/servername/public_html/core/cache/includes/elements/modsnippet/1.include.cache.php : 427) 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` FROM `modx_site_content` AS `modResource` WHERE  ( modResource.parent IN (1) AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 )  ORDER BY publishedon DESC LIMIT 5

Can anyone see anything glaringly obvious here?

Many thanks in advance.]]>
powellian Jul 11, 2017, 11:07 AM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552395
<![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552410 Quote from: lkfranklin at Jul 11, 2017, 03:44 PM
Great! smiley

Not a problem. Feel free to leave some kinds words in my trustpilot in my signature if you like wink
Done!
onward, upward, and thanks again]]>
powellian Jul 11, 2017, 05:30 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552410
<![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552409

Not a problem. Feel free to leave some kinds words in my trustpilot in my signature if you like wink
]]>
lkfranklin Jul 11, 2017, 03:44 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552409
<![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552408
[[getResources? &showHidden=`0` &tpl=`pagesTpl` &debug=`1` &parents=`[[getParentID]]` &depth=`1`]]
]]>
powellian Jul 11, 2017, 03:24 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552408
<![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552407 Thanks very much for that and for sticking with the enquiry, much appreciated.

Really need to run for an hour or so ... but this ought to be integrated in getResources IMO]]>
powellian Jul 11, 2017, 03:23 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included?page=2#dis-post-552407
<![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552406 Thanks so far]]> powellian Jul 11, 2017, 03:13 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552406 <![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552405

Give this a try.

Create a snippet called getParentID with the following code

<?php
$parentObj = $modx->resource->getOne('Parent');
return $parentObj->get('id');


Then in your call set the parent to

&parents=`[[getParentID]]`
]]>
lkfranklin Jul 11, 2017, 03:11 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552405
<![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552404
Here's the structure:
Homepage (Root level)
Contact page (Root level)
--- Parent 1 (Container)
    --- Child 1.1
    --- Child 1.2
    --- Child 1.3
    --- etc ...
--- Parent 2 (Container)
    --- Child 2.1
    --- Child 2.2
    --- Child 2.3
    --- etc ...

The 'Child' pages use a template with the getResources call; the getResources call should only list the pages within the same Parent Container (in a sidebar).

So, if you are on page 'Child 1.2', in the page sidebar you'd see listed all the pages under 'Parent 1', and only those pages, nothing from Root level or from Parent 2.
Or:
If you are on page 'Child 2.3', in the sidebar you'd see the pages under 'Parent 2', and only those pages, nothing from Root level of from Parent 1.

Using &parents=`[[@INHERIT]]` isn't working properly at all - it shows all Child pages, from both Parents. Weirdly it shows the Homepage at Root level but not the Contact page, also at Root level.

I thought @INHERIT would show only Children from the immediate Parent as the documentation states:
The @INHERIT binding will automatically find the corresponding value of the parent Resource and use that as its value.
Hope I wrote it clearer this time, please let me know if not.
it's doing my head in wink
Thanks again]]>
powellian Jul 11, 2017, 02:59 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552404
<![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552403
From what I gather you want to display all parents and children within the menu?

--- Grand Parent
    --- Parent 1
        --- Child 1
        --- Child 2
    --- Parent 2
        --- Child 1
        --- Child 2

If this is the case then you just need to set the &parent to the grandparent id and set the level to 0 to display all children and grand children resources.
]]>
lkfranklin Jul 11, 2017, 02:12 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552403
<![CDATA[Re: getResources returning nothing/zero, but is set up correctly on a fresh install. Is this a server config issue? Error logs included]]> https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552402
&parents=`[[@INHERIT]]`

It's getting there, is buggy - lists all resources at all levels, but I am getting the siblings. I'll try debugging it ...]]>
powellian Jul 11, 2017, 01:48 PM https://forums.modx.com/thread/102530/getresources-returning-nothing-zero-but-is-set-up-correctly-on-a-fresh-install-is-this-a-server-config-issue-error-logs-included#dis-post-552402