PHP code example of coreorm / slim3-view

1. Go to this page and download the library: Download coreorm/slim3-view library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

coreorm / slim3-view example snippets


# file: themes/default/layouts/default.phtml

...
<body> echo $mainContent; 

# in route
$theme->setData('myHeader', $theme->renderView('shared/header'));

# in layout

...
<head>
echo $myHeader
</head>
...

$response = new Response();
$response = Theme::instance('theme-base-dir', 'theme-name')->render($response, 'template-name', [data array]);
echo $response->getBody();

$app->get('/', function ($request, $response, $args) use ($theme) {
    $theme->setLayout('new-layout');
    return $theme->render($response, 'index', [
        'foo' => 'bar'
    ]);
});
 echo $mainContent;