mikaelmattsson / blade Goto Github PK
View Code? Open in Web Editor NEWBlade for Wordpress
License: GNU General Public License v2.0
Blade for Wordpress
License: GNU General Public License v2.0
please delete.
Hi,
I'm trying to include data with my templates. Both of these render nothing for {{ $title }}
:
@include('partials/sighting-top', array('title' => 'My Title')) // usual way
@include('partials/sighting-top')->with('title','My Title') // should work to?
So I look at this:
blade.php#L332-L337
and wonder about ->with(get_defined_vars())
.
Doesn't this just rewrite my $title
to null, since no value is supplied?
Hi,
FIrst of all, I'm pretty sure this is a stupid question. Nevertheless I had no idea where else I could find any help.
I've followed the install instructions and installed + activated the blade plugin: http://prntscr.com/2u0x1u
Next thing I did was making sure the views folder is writable by setting the chmod to 777.
According to http://wordpress.org/plugins/blade/installation/ I should now be able to use blade syntax.
Next thing I did was add the following lines to a working wp template file: http://prntscr.com/2u0xwu
The output is: http://prntscr.com/2u0y9x
As you can see, it's not parsing the template engine.
The page renders {{$helloWorld}}
Do you have any idea what I am missing? Since I realy appreciate bringing a template engine into wordpress, especially when it's based on Razor, ofwhich I have years of experience.
Thanks
Is this plugin compatible with the latest version of Blade or are there any plans to update?
I've been looking to learn Laravel for more complex projects and it seems like this could be a step in the right direction.
Thanks,
I could not find an existing issue, and I could not find that I'm using incorrect syntax. When I want to have a template rendered manually to output, in this case for an Ajax-request, I would assume the following would work:
$content = view('name-of-template')->render();
It does however not evaluate Blade-syntax like {{ 'Foo' }}
. The $content
contains the literal string {{ 'Foo' }}
.
I did use a hacky way to get it rendered properly:
$model = \WP_Blade_Main_Model::make();
$absolute_path = get_template_directory().'/name-of-template.php';
$rendered_path = $model->template_include_blade($absolute_path);
include($rendered_path);
This seems however not exactly the best approach. Am I right in assuming ->render() should work in this situation?
How to implement in wordpress?
i have created a plugin Cities in which we will have the details about any city we add to it. it was generated with WP MVC and its working properly. Now i need to implement blade in wordpress.
i have installed blade plugin in wordpress and have activated it. i have renamed some files to .blade.php say for ex. add.blade.php. when i happen to execute this particular file, it gives a warning message followed by an error message and the action is not done.
[MVC] Warning: View "admin/add" not found.
Thrown on line 204 of /var/www/html/wordpress/wp-content/plugins/wp-mvc/core/controllers/mvc_controller.php
( ! ) Warning: require(): Filename cannot be empty in /var/www/html/wordpress/wp-content/plugins/wp-mvc/core/controllers/mvc_controller.php on line 265
( ! ) Fatal error: require(): Failed opening required '' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/wordpress/wp-content/plugins/wp-mvc/core/controllers/mvc_controller.php on line 265
Could you please help me in this regard?
Could you please set v0.3.7 as tag version on the latest commit and not 0.3.7 only? Thanks!
Hi @mikaelmattsson
I'm working in a repo combining Laravel with Wordpress. Your plugin is just what I want, but I would like to implement using the already View facade provided by the Laravel, but I tried without success. :-(
Using your plugin works fine, but you did bring the Blade to WP. On my case I already have access to Laravel stuff.
Could you help me? Any advice would be nice.
My repo: https://github.com/bruno-barros/w.eloquent
Hi,
Love the idea of this, but after installing the plugin, I just get a series of errors:
Warning: file_put_contents(/Users/XXX/Desktop/XXX/wp-content/plugins/blade/storage/views/b53abbc6886c9f3bc6e767c1fc5198d6): failed to open stream: Permission denied in /Users/XXX/Desktop/XXX/wp-content/plugins/blade/application/models/main-model.php on line 47
This is then repeated on:
Warning: include(/Users/XXX/Desktop/XXX/wp-content/plugins/blade/storage/views/b53abbc6886c9f3bc6e767c1fc5198d6): failed to open stream: No such file or directory in /Users/XXX/Desktop/XXX/wp-includes/template-loader.php on line 74
The beginning of my template file is like this:
@layout('layouts.master')
{{-- Template Name: MySuperTemplate --}}
In the wp-admin page template dropdown menu the template will read as:
MySuperTemplate --}}
A way to bypass this would be to place the comment in the template file like this
{{-- Template Name: MySuperTemplate --
}}
But this is not optimal.
{{-- Template Name: MySuperTemplate --}} would be preferred.
Would this be possible to fix / implement in the plugin?
Hi, would it be possible to allow including files named .blade.php instead of just .php? Or is that not possible?
To get the composer install to work you need to set the tag on the repo, eg: v0.3.7
Are there any tests on this plugin?
If not it is urgent that we do that because the plugin is so nice and useful. Stability needed!
@section
<strong>Sect</strong>
@endsection
Hi,
First of all: Hallelujah!
Blade is such a great engine and we love to work with it!
Being able to use Blade in Wordpress is the best!
I do have a about using it in a widget.
Is there someway to include the engine in a widget?
My {{ }} are not being replaced right now!
Hey I was just wondering what version of blade this plugin uses?! Looks like @layout()
was replaced with @extends()
in version 4, so i'm wondering which to use.
I assume 3, but it'd be nice to see which version somewhere in the readme and on the plugin description page on Wordpress.org.
Thanks, nice plugin!
How could create new directives?
something like https://mattstauffer.co/blog/custom-conditionals-with-laravels-blade-directives
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.