K3-pagesdisplay-section error

I am using the pagesdisplay plugin to filter pages. This works great on my development machine (PHP 7.2.17). The simplified blueprint code is the following:

title: Site

  - width: 1/2
        headline: Speakers
        type: pagesdisplay
        query: site.index.filterBy(title, *=, Test)

On my production machine however (Apache, PHP 7.2.3), I get this error:

**The section "speakers" could not be loaded:**  Argument 1 passed to Kirby\Cms\Page::setNum()     must be of the type integer or null, string given, called in 
/kunden/123456/webseiten/kirby/src/Toolkit/Properties.php on line 130

It looks like this bug https://github.com/getkirby/kirby/issues/1552, however I’ve got this patch already applied, running Kirby from git master.

Any idea would be appreciated!

That was another issue. In your case, the issue seems to be related to sorting.

  • Does it work without the filter bit? Just using site.index?
  • Does it make any difference if you wrap the arguments in quotes? (`filterBy(“title” “*=”, “Test”)?

Both suggestions didn help. But thanks for pointing me to sorting, which indeed was the culprit. I wanted to sort this content type by both date and time (which unfortunately can’t be a combined datetime field, as I need an end time as well). The way I did it was like this:

num: '{{ page.date.toDate("Ymd") }}{{ page.time.toDate("Hi") }}'

Changing it to

num: '{{ page.date.toDate("Ymd") }}'

resolves this problem. Is there a way to combine both fields for sorting?

It’s also strange that this only seems to be happening on my production machine…

Try a custom page method or page model.

Can you point me to an example? Looking at the docs I don’t quite see how I could use this with num:

Sorry, I got distracted while fetching the links:

Then you should be able to use this newly created method/model like this:

num: '{{ page.customMethod }}'

Your method/model would return the formatted datetime string.

Use a model if you only need it for a single page template. Use a method if you need it in multiple page templates.

How come this still gives me the same error?


num: '{{ page.datetime }}'



class speakerPage extends Page
  public function datetime() {
    return intval($this->date()->toDate("Ymd") . $this->time()->toDate("Hi"));

Kirby::plugin('test/pageModels', [
    'pageModels' => [
        'speaker' => 'speakerPage'

What am I missing?

Hm, it works for me in a Starterkit, even with the pagesdisply plugin. although I simple put the model in the /site/models folder instead of registering it in a plugin, don’t know if that makes a difference.

Locally, it works as well - both as a plugin, as well as model. Unfortunately on my production server it still doesn’t. I guess this has to do with the PHP version, configuration or the like.

Have you tried with SpeakerPage instead of speakerPage, with a capital “S”?

Yes. Again, it works locally, just not on the server.

@dgsiegel I ran into the same issue, when deploying a site to a test server, using the same date/time format as in SpeakerPage example given in this thread. In my case, it was caused by the server itself, because it is running a 32-bit version of PHP and the max value for the integer type is 2147483647. On my local machine, whcih runs the 64-bit version of PHP, the error does not occur and everything works fine.

@texnixe I don’t know, if this can be fixed easiliy (probably not, as it would require workarounds like a library, that can deal with integers of any size. But I think, this should be mentioned in the docs aas it is probably not obvious for most people (including myself)?

1 Like