Skip the setup. Our team will have you taking orders in 24 hours. Get started →
Version notice: This documentation is for version 3, but the latest available version is version 4.
Customize

Markup Guide

Introduction Variables Directives @page @partial @component @content @partialIf @hasComponent @stack @styles @scripts @verbatim @if @auth @unless @for @inj...

TastyIgniter adds a number of directives and variables to the Blade template engine.

$this->page
$this->layout
$this->theme
$this->param

Directives are a unique feature to Laravel Blade and are wrapped with {{ }} characters or prefixed with @ character.

The @page tag renders the contents of a page into a layout template.

@page
@partial('footer')
@component('cartBox')
@component('cartBox', ['checkStockCheckout' => TRUE])
@partial('cart::cartBox')
@content('welcome.htm')
@partialIf('cartBox')
@hasSection('navigation')
    <div class="pull-right">
        @yield('navigation')
    </div>

    <div class="clearfix"></div>
@endif
@push('sidebar')
	Add this content to the sidebar
@endpush
@stack('sidebar')
@push('scripts')
    This will be second...
@endpush

// Later...

@prepend('scripts')
    This will be first...
@endprepend
@styles
function onStart()
{
    $this->addCss('assets/css/style.css');
}
@push('styles')
		<link rel="stylesheet" href="assets/css/app.css">
@endpush
@scripts
function onStart()
{
    $this->addJs('assets/js/script.js');
}
@push('scripts')
		<script src="assets/js/app.js"></script>
@endpush
Hello, @{{ name }}.
@verbatim
    <div class="container">
        Hello, {{ name }}.
    </div>
@endverbatim
@if (count($categories) === 1)
    I have one category!
@elseif (count($categories) > 1)
    I have multiple categories!
@else
    I don't have any categories!
@endif
@auth
    // The user is authenticated...
@endauth

@guest
    // The user is not authenticated...
@endguest
@unless (Cart::content())
    Cart is empty.
@endunless
@for ($i = 0; $i < 10; $i++)
    The current value is {{ '{{ $i }}' }}
@endfor

@foreach ($categories as $category)
    <p>This is category {{ '{{ $category->name }}' }}</p>
@endforeach

@forelse ($categories as $category)
    <li>{{ '{{ $category->name }}' }}</li>
@empty
    <p>No categories</p>
@endforelse

@while (true)
    <p>I'm looping forever.</p>
@endwhile
@inject('metrics', 'App\Services\MetricsService')

<div>
    Monthly Revenue: {{ '{{ $metrics->monthlyRevenue() }}' }}.
</div>
Directive Equivalent
@extends Use Theme Layouts
@include Use @partial
@includeIf Use @partialIf
@includeWhen Use @partialWhen
@includeUnless Use @partialUnless
@includeFirst Use @partialFirst
@endcomponent Use @component
@componentfirst Use @component
@endcomponentfirst Use @component

Did this answer your question?

Your feedback helps us improve our help articles.

See a mistake? Edit this page on GitHub

Need more help?

Explore the help center, join the community, or get priority support from the TastyIgniter team.