I’m using a static render method in a route definition to render some JSON from a page template and pass it into the home template.
$data = array();
$data['initData'] = array(
'collection' => static::render($collection), // Render the start collection template JSON (site/templates/tour-dates.php)
'dates' => static::render($dates), // Render the Tour Dates template JSON (site/templates/tour-dates.php)
'slug' => $slug,
);
return array('home', $data); // return the home page, passing in the dates and collection and initial slug data (site/templates/home.php);
This is working perfectly — when I visit the site, the homepage template is rendered, and the data is passed into the template.
However when I turn on caching (c::set('cache', true);
), the collection page is rendered and returned and cached, rather than the homepage. (It will always return at the first static::render() it finds — so if I move dates above collections, it will return the dates page JSON.