Page model on an ajax page?

I have an ajax page which I created with a route. Therefor it’s not a “normal” page. It’s like a virtual page.

I use this to get my $pages object:

$pages = kirby()->site()->pages();

Then I use a snippet where I put the page object:

$out .= snippet(
    'items',
        array(
            'pages' => $pages,
    ),
    true
);

Question

Can I use a page model in this case? How? It’s not a real page.

In theory, yes ($pages contains the real pages).
But unfortunately, once again, models are loaded after plugins. Plugins are currently simply not made for complex stuff like this. :smile:

I always seems to end up with the same kind of issue, the order of things. Thanks!

Haha, it seems so. :smiley: