All files under this directory will be symlinked to app/views/
,
then you can use them by $this->render()
(in controllers),
or $this->include()
(inside templates).
For example:
phwoolcon-package/views/default/foo.phtml
[1]:
<?php
/* @var \Phwoolcon\View\Engine\Php $this */
/* @var string $name */
?>
<h1><?= __('Hello %name%', ['name' => $name]) ?></h1>
<div>
<?php $this->include('bar.phtml') ?>
</div>
phwoolcon-package/views/default/bar.phtml
:
<?php
/* @var \Phwoolcon\View\Engine\Php $this */
?>
<p><?= __('Welcome to Bar') ?></p>
[1]: The term
default
in the path is the theme name, please seeconfig/view.php
(view.theme
) for details.
Then you can render it in a controller:
<?php
/* @var \Phwoolcon\Controller $this */
$this->render('foo', ['name' => 'John']);
It will present:
<h1>Hello John</h1>
<div>
<p>Welcome to Bar</p>
</div>