Create new page in slim

To create a new page in Slim, you can follow these steps:

  1. Create a new file in the app/views directory with a .php extension. For example, about.php.
  2. In this file, create a new PHP class that extends the Slim\View class. For example:
    
    <?php
    namespace App\View;

use Slim\View;

class AboutView extends View { public function render() { return 'This is the about page'; } }

3. In your Slim application's `routes.php` file, add a new route that maps to the new view. For example:
```php
<?php
$app->get('/about', function () {
    $this->view->render('about');
})->name('about');
  1. In your Slim application's app.php file, add the new view to the views array. For example:
    <?php
    $app->views->addPath(__DIR__. '/views');
  2. Finally, create a new template file in the app/views directory with the same name as the view class (e.g. about.php). This file will contain the HTML content for the new page.

Here's an example of what the about.php file might look like:

<?php
<h1>About Us</h1>
<p>This is the about page.</p>

That's it! You should now be able to access the new page by visiting http://localhost/about in your web browser.

Note: Make sure to adjust the namespace and class name to match your application's structure and naming conventions.