zloynick / joole-components-renderer
Installs: 10
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:joole-component
Requires
- php: ^8.1
- zloynick/joole-framework: ^8.1
This package is not auto-updated.
Last update: 2025-06-26 11:50:44 UTC
README
This component is an implementation of the html content renderer.
Getting started
- Install this dependency via composer:
composer install zloynick/joole-components-renderer
Configuration
Add to components this in your joole.php configuration file:
'components' => [
...,
[
'name' => 'renderer',
'class' => \joole\components\renderer\RendererComponent::class,
// Component options
'options' => [
// Views path
'views' => __DIR__.'/../views/',
],
],
...,
],
Using
Views
Create your first view file:
----------index.php-----------
...
/** @var array $rating */
foreach($rating as $place => $name){
...
}
...
Rendering with params
Every param name is variable, that can be used in view file.
$viewObject = \joole\framework\Joole::$app->getRenderer()->renderView('index.php', [
'rating' => ['Anastasia', 'Mikhail', 'Artem'],
]);
JS/CSS rendering
You can also add CSS/JS content to view:
...
$viewObject->renderJs(' console.log("Hello, world!")) ');
$viewObject->renderCss('body{ background-color: #c0c0c0 }');
...