pdoPage fails with 500 error

– ModX 3.0 on Modxcloud –

Using this snippet call:
[[!pdoPage? &parents=[[++site_news]] &limit=9 &tpl=item_nieuws &ajaxMode=scroll ]]
I get this error in the console when I scroll the page or with &ajaxMode=button as well:
jquery-3.5.1.min.js:2 POST https://c0618.paas1.ams.modxcloud.com/assets/components/pdotools/connector.php 500

The php error log shows this:
[07-Apr-2022 14:16:11 Europe/Amsterdam] PHP Fatal error: Uncaught Error: Using $this when not in object context in /paas/c0618/www/assets/components/pdotools/connector.php:8 Stack trace: #0 {main} thrown in /paas/c0618/www/assets/components/pdotools/connector.php on line 8

Can I fix this somehow or should I report this with pdoTools repo - I couldn’t find it.

The $this on this line ($this->services->get('error');) probably should be $modx.

1 Like

I had to change it via nano in the terminal :slight_smile: as ModxCloud doesn’t allow editing php files, but the error is gone. Thanks a lot.
Still have to figure out how to make pdoPage load more content on scroll, as the rtfm is not that elaborate about that.

Maybe if you add php to the system setting upload_files it works.

Any errors in the console of the browser’s developer tools?
Have you added jQuery to your template?

Adding php to the system setting works!

And yes I have jQuery loaded and no errors in the console.
The manual mentions making an Ajax request like
$.get('document.html?page=5', function(response) { console.log(response); }, 'json');
I’m not sure if that will help if the page has to load more items on scroll. Or is that just meant as a way to initialize the built-in script from pdoPage that handles the loading of extra items?
I guess I have to write an on-scroll handler that makes the Ajax request to a page or the same page?

The markup under “Load on scroll” in the documentation should work without the need to write custom js-code.

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.