mise en forme des définitions dans index.php

This commit is contained in:
2025-05-08 12:19:10 +02:00
parent a42f8a5f18
commit 74beb1388a
3 changed files with 23 additions and 12 deletions

View File

@ -50,7 +50,16 @@ if ($grille_valide) {
foreach ($grille->lignes[$y] as $mot) {
$definitions = $grille->dico[strlen($mot)][$mot];
if (count($definitions)) {
$definitions_horizontales[$y][] = $definitions[mt_rand(0, count($definitions) - 1)];
$definition = $definitions[mt_rand(0, count($definitions) - 1)];
if (strpos($definition, "#") !== false) {
[$definition, $nb_mots] = explode("#", $definition);
$definition .= " <small>($nb_mots mots)</small>";
}
if (strpos($definition, "@") !== false) {
[$definition, $auteur] = explode("@", $definition);
$definition .= " <small><em>$auteur</em></small>";
}
$definitions_horizontales[$y][] = $definition;
}
}
}
@ -60,7 +69,16 @@ if ($grille_valide) {
foreach ($grille->colonnes[$x] as $mot) {
$definitions = $grille->dico[strlen($mot)][$mot];
if (count($definitions)) {
$definitions_verticales[$x][] = $definitions[mt_rand(0, count($definitions) - 1)];
$definition = $definitions[mt_rand(0, count($definitions) - 1)];
if (strpos($definition, "#") !== false) {
[$definition, $nb_mots] = explode("#", $definition);
$definition .= " <small>($nb_mots mots)</small>";
}
if (strpos($definition, "@") !== false) {
[$definition, $auteur] = explode("@", $definition);
$definition .= " <small><em>$auteur</em></small>";
}
$definitions_verticales[$x][] = $definition;
}
}
}