Add a new page
Open the packages/acme/etc/pages.php
file, and add a new page:
<?php
$config = [
'acme' => [
Core_Page::TYPE => [
/* ... */
'/contact.html' => [
'class' => Acme_Page_Contact::class, // Optional
'content' => 'content/contact',
'title' => 'Contact',
'description' => 'Contact our team',
'telephone' => '+33 610506070',
],
/* ... */
],
],
];
Warning:
- For a route with an extension, the first slash is required:
/slug.html
- For a route without an extension, the first and last slashes are required:
/slug/
Create a new class: packages/acme/app/Acme/Page/Index.php
<?php
declare(strict_types=1);
class Acme_Page_Contact extends Core_Page
{
public function execute(): void
{
$this->setAddress("459 Walker Cape, Powellchester, OL16 3NA");
}
}
Finally, create the template file: packages/acme/template/content/contact.phtml
<h2>Contact us!</h2>
<p>Telephone: <?= App::escapeHtml($this->getTelephone()) ?></p>
<p>Address: <?= App::escapeHtml($this->getAddress()) ?></p>
Access to /contact.html
in your browser!