I have a problem using routes and pages with additional data.
According to the example in the documentation I built the following route:
array(
'pattern' => 'key/(:any)',
'action' => function($key) {
$data = array('key' => $key);
return array('specials/archive', $data);
}
),
That code produces the following error:
FastCGI: server “/…/…/cgi-bin/php5-fcgi-*-80-mydomain” stderr: PHP message: PHP Fatal error: Call to a member function code() on null in /…/…/web/kirby/kirby.php on line 526
This is the code snippet that produces the error:
if($this->site()->multilang()) {
// path for the language file
$file = $this->roots()->languages() . DS . $this->site()->language()->code() . '.php';
// load the file if it exists
if(file_exists($file)) include_once($file);
}
I also tried to build the route as de/key/(:any) or call the page as de/specials/archive without success.
How can I set a language information in a route to make this work?