Page visit error doesn't work

I have a very simple route in my config, but I can’t make it visit the error page. I don’t want to use go because I don’t want a redirect.

c::set('routes', array(
	array(
		'pattern' => 'inbox/(:all)',
		'action'  => function() {
			return page()->visit('error', 'sv');
		}
	)
));
  • I know the pattern work.
  • The visit page thing do something because when I do a print_r it show an object and then crasch because of overload.
  • When having it like this it shows nothing, a white page.
  • I do have a page called error in my panel. I did not change that and I even tried to add a template called error.php without luck.

Any ideas?

It has to be site()->visit() and not page()->visit(). :wink:

Another improvement so that the route works even when changing the path of the error page:

$errorPage = site()->errorPage();
return site()->visit($errorPage->uri(), 'sv');
2 Likes

I’ve read the docs, read forum threads, tested alot and it was a typo!? Oh, I’m feeling stupid right now.

I even tried the version with errorPage in a thread from @texnixe but of course it did not work because I still hade page instead of site.

Case solved.