PHP code example of mtymek / blast-view

1. Go to this page and download the library: Download mtymek/blast-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/ */

    

mtymek / blast-view example snippets


return [
    'view_manager' => [
        'layout_template' => 'layout/layout.phtml',
        'template_path_stack' => [
            __DIR__ . '/../view',
        ],
    ],
];

use Zend\View\Model\ViewModel;
use Blast\View\View;

$viewModel = new ViewModel(
    [
        'name' => 'Mat'
    ]
);
$viewModel->setTemplate('index.phtml');

$view = $serviceManager->get(View::class);
echo $view->render($viewModel);


$layout = new ViewModel();
$layout->setTemplate('layout/layout.phtml');
$view->setLayout($layout);

$viewModel = new ViewModel();
$viewModel->setTemplate('index.phtml');
echo $view->render($viewModel);

return [
    'view_helpers' => [
        'invokables' => [
            'foo' => FooHelper::class,
        ]
    ],
];

html
<html>
<head>
</head>
<body>
     echo $this->content