commit a59f40bc79c33925647ae0702a40d063d7fefea8 Author: Persson-dev Date: Wed Oct 9 17:03:46 2024 +0200 premier commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82cd1f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +appli/vendor \ No newline at end of file diff --git a/appli/biblio.php b/appli/biblio.php new file mode 100644 index 0000000..e10841b --- /dev/null +++ b/appli/biblio.php @@ -0,0 +1,16 @@ + 'cache', 'autoescape' => true); +$options_dev = array('cache' => false, 'autoescape' => true); +/* stocker la configuration */ +$twig = new Twig\Environment($loader); +/* charger+compiler le template, exécuter, envoyer le résultat au navigateur */ +echo $twig->render('biblio.twig', $donnees); \ No newline at end of file diff --git a/appli/modele/data.php b/appli/modele/data.php new file mode 100644 index 0000000..c40cd3f --- /dev/null +++ b/appli/modele/data.php @@ -0,0 +1,19 @@ + 'Bibliotheque', + 'titre_page' => 'Liste des livres', + 'date' => date("d/m/Y"), + // pour simplifier l'exemple, les données sont définies + // statiquement (généralement elles sont extraites d'une BD) + 'biblio' => array( + array('titre' => 'N ou M', 'nom' => 'Christie', 'prenom' => 'Agatha'), + array('titre' => '1984', 'nom' => 'Orwell', 'prenom' => 'George'), + array('titre' => 'Dune', 'nom' => 'Herbert', 'prenom' => 'Frank') + ) + ); + return $data; +} diff --git a/appli/vue/biblio.twig b/appli/vue/biblio.twig new file mode 100644 index 0000000..694020f --- /dev/null +++ b/appli/vue/biblio.twig @@ -0,0 +1,34 @@ + + + + + {{ titre_doc }} + + + + +

{{ titre_page }} - {{ date }}

+ {% if biblio is not empty %} + + + + + + + + + {# afficher les titres et noms des livres #} + {% for item in biblio|sort %} + + + + + {% endfor %} + +
TitreAuteur
{{ item.titre }}{{ item.nom|capitalize }}
+ {% else %} + Aucun livre dans la bibliothèque. + {% endif %} + + + \ No newline at end of file