pedroborges / kirby-blade-template Goto Github PK
View Code? Open in Web Editor NEW⬢ Laravel Blade template component for Kirby CMS.
License: MIT License
⬢ Laravel Blade template component for Kirby CMS.
License: MIT License
I think you need to remove the vendor folder from repository and write to use composer init
in the folder to install the vendor packages.
Something like {{ $page->text()->kirbytext() }}
where the contents includes an &
gets converted to &
. Any ways around this?
After installing kirby-blade-template the CMS did not start to work.
Kirby and Laravel have an e() helper function and Kirby cannot redeclare it.
As a workaround I was extending the index.php to look like this. I don't know if there is any other workaround.
require __DIR__ . '/kirby/config/helpers.php';
require __DIR__ . '/kirby/bootstrap.php';
echo (new Kirby)->render();
So I used the master.blade.php
and default.blade.php
examples from the README, but got an error catched by Whoops:
Whoops \ Exception \ ErrorException (E_ERROR)
Method Illuminate\View\View::__toString() must not throw an exception
And nothing in the stack trace, so Whoops showed my index.php
, which was not very useful.
With Whoops disabled, I get this error printed in the page:
Fatal error: Method Illuminate\View\View::__toString() must not throw an exception in /Users/Florens/[…]/index.php on line 0
Turned out I was using @extends('layouts.master')
but had put my master.blade.php
at the root of the templates folder, rather than in a layouts subfolder. But with no relevant errors, that can be hard to figure out.
In this specific case, both the basic error and the Whoops error handler page show the same unhelpful error. Here is a case where Whoops shows that unhelpful error but the basic error output is more helpful:
@section('title', $page->doesntexist)
Basic output:
Notice: Undefined property: Page::$doesntexist in /Users/Florens/[…]/site/cache/d2039ed96c3f8c364028a47d23fef68b5cfe6b8d.php on line 1
Whoops output:
Whoops \ Exception \ ErrorException (E_ERROR)
Method Illuminate\View\View::__toString() must not throw an exception
For the record, I wrote https://github.com/fvsch/kirby-twig and since Twig was reporting meaningful errors but not adding them to a stack trace, I had to skip using Whoops and catch the errors myself to display an error page. Feel free to reuse my code if you think you want to do something similar.
I see this https://github.com/pedroborges/kirby-blade-template/blob/master/src/Template.php#L94-L95 and I don't understand why this, can explain?
Just curious to know if this works with Kirby 3?
I haven't had the opportunity to use it (v3) yet and don't think I would be able to go back to pre blade Kirby!
Hi,
Should the template cache always be active? I expected it to follow the c::get('cache')
(or kirby()->get('option', 'cache')
) setting.
It was a bit puzzling to get an error saying "in in /Users/Florens/[…]/site/cache/d2039ed96c3f8c364028a47d23fef68b5cfe6b8d.php" when I have caching disabled locally.
Now I’m mostly puzzled because with Twig, the template cache tends to be a bit sticky and require manual purging sometimes. With Blade, it seems that it's picking up template changes easily, so maybe there's no value in avoiding caching.
What do you think?
Whoops \ Exception \ ErrorException (E_ERROR)
Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: Parse error: syntax error, unexpected ')', expecting ',' or ';'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.