- Mise en place de Svelte 4 avec Vite pour le frontend (SPA) - Simplification des templates PHP (header/footer minimalistes) - Création de templates JSON pour API (home, about, expertise, portfolio, jouer, game, blog, article, project) - Ajout d'un controller de site pour définir genericData globalement - Structure des stores Svelte (page, navigation, locale, site) - Router avec navaid pour navigation SPA et interception des liens - Composants layout (Header, Footer, Cursor) et vues de base - Build Vite vers assets/dist/ (index.js/css) - Header PHP détecte assets/dist pour basculer dev/prod Architecture fonctionnelle de base établie, à améliorer et compléter. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
26 lines
844 B
PHP
26 lines
844 B
PHP
<?php
|
|
|
|
$specificData = [
|
|
'intro' => [
|
|
'title' => $page->intro_title()->value(),
|
|
'text' => $page->intro_text()->value()
|
|
],
|
|
'articles' => $page->children()->listed()->sortBy('date', 'desc')->map(function($article) {
|
|
return [
|
|
'title' => $article->title()->value(),
|
|
'slug' => $article->slug(),
|
|
'url' => $article->url(),
|
|
'date' => $article->date()->toDate('Y-m-d'),
|
|
'date_formatted' => $article->date()->toDate('d/m/Y'),
|
|
'intro' => $article->intro()->excerpt(200),
|
|
'cover' => $article->cover()->toFile()?->url(),
|
|
'author_name' => $article->author_name()->value(),
|
|
'author_photo' => $article->author_photo()->toFile()?->url()
|
|
];
|
|
})->values()
|
|
];
|
|
|
|
$pageData = array_merge($genericData, $specificData);
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode($pageData);
|