lukasleitsch / kirby-blade

Enable Laravel Blade Template Engine for Kirby 4
MIT License
17 stars 4 forks source link

Blade for snippets and blocks #9

Closed iskrisis closed 2 years ago

iskrisis commented 2 years ago

Hi, is there way to use blade in snippets and for blocks? If not is there some way to use components in non blade templates? Maybe some global function that would render them?

lukasleitsch commented 2 years ago

is there way to use blade in snippets

An alternative or replacement for snippets are subviews or components.

and for blocks?

Currently, not supported.

If not is there some way to use components in non blade templates?

You could use the render method to render a component inside a php template.

<?= \Illuminate\Support\Facades\Blade::render('<x-alert />') ?>

Or you could use the component() helper: https://github.com/lukasleitsch/kirby-blade/blob/main/helpers.php#L15

iskrisis commented 2 years ago

@lukasleitsch very helpful thank you so much!

lukasleitsch commented 2 years ago

@iskrisis You're welcome