ekandreas / bladerunner

WordPress plugin for Laravel Blade templating DEPRECATED
http://bladerunner.elseif.se
12 stars 1 forks source link

Trouble passing variables #31

Closed seafarer closed 8 years ago

seafarer commented 8 years ago

I am not understanding how the template data filter works. I have tried just using the sample code in my theme a whole bunch of different ways but it always reports undefined variable. Can you shed any light on how to use this filter properly?

seafarer commented 8 years ago

Ok, I got this to output data by using

$data = [
    'this'  => 'that',
    'other' => 'perhaps',
];
add_filter('bladerunner/templates/data/single-activity', $data);

And then using

bladerunner('views.pages.single-activity', compact('data'));

But I am getting error notices that say "Undefined offset: 0" on the add_filter line above. How can I get rid of that error?

ekandreas commented 8 years ago

There is no template filter in that meaning. Just deliver the data to the bladerunner function and use it in your blade template.

seafarer commented 8 years ago

Ok I got this working. Thanks.

ekandreas commented 8 years ago

Great!