Open tremby opened 8 years ago
Why would you want this?
I am using a package which provides various partials in Blade format, like widgets. I don't want to rewrite this package with Twig templates, because then I wouldn't benefit from upstream fixes.
It would also be useful if I were to transition an existing application from Blade to Twig (as I have been considering doing). It's not practical with applications of a certain scale to do it all at once: this would allow me to do it piece by piece.
What about adding the 'View' facade to your config, and call View.make('view-name')
, or add view
to the functions in the config: {{ view('view-name') }}
That seems reasonable, at least for now.
In theory would it be possible to overload Twig's include
statement to run Laravel's view
behind the scenes? It would be nice if this were transparent, i.e. the include
was format-agnostic.
I don't think you can really mix them, except for just rendering something as a string.
In this particular case that would suffice. But in other cases (transitioning an app bit by bit) it would not.
That's a shame to hear.
You can consider this ticket a wishlist item, then. Thanks.
These issues really need closing.
I saw that this was asked in #39 and was then referenced as part of "Improve template loading" in 0.6.0 (#62 and #72) and checked off, but it's not clear how exactly it was improved.
The suggested workaround of
{{ view_make('view-name') }}
is not working for me. I'm trying to include a partial provided by a package so I'm doing{{ view_make('package-name::template-name') }}
. I'm toldview_make
doesn't exist.Attempting to include the template directly (with Twig's include statement) doesn't work either.