Template HTML Syntax
We use the powerful Blade rendering engine behind the scenes. This allows you to use many blade directive like @if()
, @empty()
, and @for()
.
To display an attribute in your template, use the {{ $attributeName }}
syntax.
To display a multi-line attribute, use the {!! $attributeName !!}
syntax.
To test an attribute in a condition, use the @if($attributeName)
syntax.
Whitelisted conditions
The following condition methods are available
@if
@elseif
@else
@for
@foreach
@empty
@isset
@switch
@case
@break
@continue
@default
Live editing
If you want an attribute to use the Kanka live editing, instead of calling your attribute with {{ $attributeName }}
, you can use @liveAttribute('attributeName')
. This will inject a span class="live-edit" data-id"xxx"
element with the rendered attribute value in it.
Limitations
Since we use the blade engine in the background, we have a few limitations. Attribute names can't have a space or special characters like '",.-\/@([{#+=
, and can't start with a number (basically any invalid variable name in PHP). $dext_érité
is valid, but $life points
isn't.
Handling Errors
When an error happens while rendering a template, a message will warn the user, along with a hint on what went wrong. The most common cause is trying to display an attribute that doesn't exist without testing @isset($attributeName) @endisset
beforehand.
Another common cause is testing for `$attribute
when the attribute name is $Attribute
(notice the capital letter). Our rendering engine is case sensitive.