On the front page, you only read the beginning of each article. The villagers want the rest! Each article will get its own page, at the address /articles/ followed by its slug.
Your mission
- Declare the route
GET /articles/{slug}. The curly braces mark the variable part of the address: its handler receives an array$parametres(parameters), and$parametres['slug']is'the-pumpkin-festival'for/articles/the-pumpkin-festival. Find the article withRedaction::article($parametres['slug']). - The article page: a
<main class="lecture">with the full article, returned by$article->versHtmlComplet()(the nephew added it toArticle), and a link<a class="retour">← Back to the front page</a>to the front page. Everything is laid out byPage::rendre(), and the browser tab shows “article title — The Saint-Glinglin Gazette”. - In
src/Contenu/Article.php, on the front page, the title of each article becomes a link to its page.
Build every address with Url::vers() (to), never hard-coded.
Reminder
{slug} is a route parameter: it accepts any text without a /, which FastRoute puts in $route[2], the array passed to the handler. A method of the class can read its private properties: versHtmlComplet() is allowed to use $this->texte, but code outside the class is not.