Groovel blog : The platform for web artisans


A ready starter application to understand how groovel works with its template engine : Blade Laravel

by groovel

Posted on 2016-11-22 20:49:57

A ready starter application to understand how groovel works with its template engine :Blade

In the installation of groovel , you've got a ready simple blog that you can customize and play with
the blade engine template.This is the common template engine working with laravel and optimizing to make template reusable



When you install groovel, all template layout blog (.blade) are copied from starter-templates, and then published in resources/views directory, assets are published in the public directory
All data are available via session data. In the main template blog.blade file, we see the variable
{{content}} this is the data that groovel loads when you access to the blog page
In fact if we follow the workflow a middleware ( like nodejs) intercepts the request , and determines with the url you access,the controller to call that will init the session context.

The workflow is :

blogs->called Groovel\Cmsgroovel\Http\Middlewares\ContentsBeforeMiddleware.php class :
\Session::put('contents',$contents); we say to groovel to call the loadContents method to load the contents, depending of the layout and on the language.

If we focus on the template .blade
The syntax is simple :
loops @foreach , conditional :@if
inheritance is possible

@extends inheritance the base template
and override the section content @section in the base template
@foreach ($contents as $content) , loop all the contents from the session
and more inside the laravel box ,there is a feature to paginate the content :{!! $contents->render() !!}

An extract of the file blog.blade.php :


  @foreach ($contents as $content)
       by {!!$content['author']!!}Posted on {!!$content['created_at']!!}

{!! $contents->render() !!}

for more you can visit :

Why i decide to use blade? because i wanted to stay in the same technical domain than to propose to use angularjs or vuejs in order to limit the complexity but it is possible to propose api services that interoperate with these frameworks.

In a next post i will explain how do i expose API that you can use in ionic framework ;)

Leave a Comment: