16/11/14 blade , templates

Flexible blade setup

Once you have noticed the breeze the blade templating engine will bring into your templates, it’s about time to share a flexible template setup. I’ll share mine below but it’s by far the best setup in every situation.

Our file structure:

- master.blade.php

- header.blade.php
- menu.blade.php

- page1.blade.php
- page2.blade.php

Continue reading

0 likes no responses
16/11/14 blade , laravel 5 , templates

Laravel Blade templates

If you have never worked with a templating engine it’s about time you open the door to let a breeze run through your projects! I’m sure you will be amazed about how easy Blade will be to use as well as how clean your templates will look. Sharpen your Blades, here we go!

This is what my controller function would look like, it’s called from the routes file and will make sure our application has maximum flexibility.

public function view() {
    $data['title'] = 'Titel pagina';
    $data['subtitle'] = 'Subtitel pagina';
    $data['random'] = rand(1,3);
    $data['loop'] = ['<em>Item 1</em>', '<i>Item 2</i>', '<b>Item 3</b>'];
    $data['users'] = [];
    return view('pages.example', $data);

Continue reading

0 likes no responses