Closed nathanaelphilip closed 7 years ago
add_filter('bladerunner/template/bladepath', function($paths) {
if(!is_array($paths)) $paths = [$paths];
$paths[] = get_template_directory() . "/app/views";
return $paths;
});
i tried that as well, but I’ll try again!
this is the error i get:
Fatal error: Uncaught InvalidArgumentException: View [views.index] not found. in /app/vendor/illuminate/view/FileViewFinder.php:137 Stack trace: #0 /app/vendor/illuminate/view/FileViewFinder.php(79): Illuminate\View\FileViewFinder->findInPaths('views.index', Array) #1 /app/vendor/illuminate/view/Factory.php(128): Illuminate\View\FileViewFinder->find('views.index') #2 [internal function]: Illuminate\View\Factory->make('views.index', Array, Array) #3 /app/content/plugins/bladerunner/src/Blade.php(127): call_user_func_array(Array, Array) #4 /app/content/plugins/bladerunner/src/Blade.php(51): Bladerunner\Blade->__call('make', Array) #5 /app/content/plugins/bladerunner/globals/helpers.php(21): Bladerunner\Blade->render('views.index', Array) #6 /app/content/plugins/bladerunner/globals/filters.php(73): view('views.index', Array) #7 /app/cms/wp-includes/class-wp-hook.php(298): {closure}('/app/content/th...') #8 /app/cms/wp-includes/plugin.php(203): WP_Hook->apply_filters('/app/content/th...', Array) #9 /app/cms/wp-includes/templa in /app/vendor/illuminate/view/FileViewFinder.php on line 137
Can you provide me with the theme code?
And if you put this in index.php?
<?php
echo view('app.views.index');
I will take a look more close soon and respond to you.
i put the above code in the index.php
and i’m still getting a fatal error
You can go two ways with quirky folders in this case:
echo view('app.views.index');
or
<?php
// file: app/controllers/index.php with controllers path set
use Bladerunner\Controller;
class IndexController extends Controller { protected $template = 'app.views.index';
public function hello()
{
return 'hello world';
}
}
So you have to choose if you would like to use controllers or only views.
I think that you have a conflict now with both techniques at the same time :-)
should i remove this:
add_filter('bladerunner/template/bladepath', function($paths) {
if(!is_array($paths)) $paths = [$paths];
$paths[] = get_template_directory() . "/app/views";
return $paths;
});
?
It depends! the template/bladepath is made for plugin dev. Go for the controller and set the template path in each controller instead! So much cleaner and easy to understand!
oh ok – i didn’t know that! Thanks for your help!
Hope you are getting forward and get use of the plugin. Blade is a great templating language.
yeah! i was going to just use the default structure if needed, but this works for me. it’ll make things a bit more explicit!
Hi hi! Back again :)
I have a
views
folder insideapp
, so it’sTHEME/app/views
and inside that, i haveindex.blade.php
i can’t get bladerunner to recognize this template :/. It does work if I just put the
views
folder directly inside theTHEME
folder.Thanks!