Zing. compile-to-PHP template engine GitHub ↗

Includes

Use @include to render another template in place:

@include('partials.notification', ['count' => 3])

The included template is compiled and cached just like any other template. It only receives the variables explicitly passed as the second argument.

Inheriting scope

Use inherit: true to include the calling template's variables as well:

@include('partials.header', inherit: true)

@include('partials.header', ['title' => 'Custom'], inherit: true)

inherit: true only reaches one level up — an included template's includes do not automatically see its caller's caller's variables.