Hi!
I’m following this cookbook article on generating JSON with Kirby: https://getkirby.com/docs/cookbook/templating/generating-json for creating an AJAX-based website.
Simple question:
On a multilanguage page (D/E), instead of having only one template /site/templates/blog.json.php
, to make it work, would it be
/site/templates/blog.en.json.php
and /site/templates/blog.de.json.php
?
With the two json files containing something like:
$json[] = [
'title' => (string)$article->title("de"),
];
and something like:
$json[] = [
'title' => (string)$article->title("en"),
];
Edit:
So there would be: blog.de.txt
and blog.en.txt
but I can’t really figure out how the multi-language AJAX call in Kirby would look like. Up until now, I only scripted single-language AJAX-based Kirby websites which call a PHP file like:
<?php if(kirby()->request()->ajax()) {
snippet('main');
}
?>
Thanks for any input!