Hi guys i'm trying to integrate htmlburger/wpemerge-blade with wp-emerge-theme but cannot getting to work.
i installed htmlburger/wpemerge-blade with composer and i added the service provider to config.php
here is my "app/config.php"
<?php
/**
* WP Emerge configuration.
*
* @see https://docs.wpemerge.com/configuration.html
*/
return [
/**
* Array of service providers you wish to enable.
*/
'providers' => [
\WPEmergeBlade\View\ServiceProvider::class
],
/**
* Array of global middleware to apply to all requests.
*/
'global_middleware' => [
],
/**
* Other config goes after this comment.
*/
];
Here is my
"app/src/controllers/MainController.php"
<?php
namespace App\Controllers;
use WPEmerge\Requests\Request;
class MainController {
public function home( Request $request, $view ) {
// Add back-end logic here
// for example, prepare some variables to pass to the view
// or validate request parameters etc.
$name = 'foobar';
// return app_output( 'Hello World!' ); //this line uncommented work and i see the message
//I tried also templates/baselayout || templates/baselayout.blade.php
return app_view( 'templates.baselayout' )
->with( [
'name' => $name,
] );
}
}
Here is my view
"theme/template/baselayout.blade.php"
<?php
/**
* ------------------------------------------------------------------------
* Routes
*
* @see https://docs.wpemerge.com/routing/methods.html
* ------------------------------------------------------------------------
*/
// Using our ExampleController to handle the homepage, for example.
Router::get( '/', 'App\Controllers\MainController@home' );
// If we do not want to hardcode a url, we can use one of the available route conditions instead:
/*
Router::get( ['post_id', get_option( 'page_on_front' )], 'App\Controllers\ExampleController@home' );
*/
/**
* Pass all front-end requests through WPEmerge.
* WARNING: Do not add routes after this - they will be ignored.
*
* @see https://docs.wpemerge.com/routing/methods.html#handling-all-requests
*/
Router::handleAll();
/**
* ------------------------------------------------------------------------
* Globals
*
* @see https://docs.wpemerge.com/view/global-context.html
* ------------------------------------------------------------------------
*/
/*
View::addGlobal( 'foo', 'bar' );
*/
/**
* ------------------------------------------------------------------------
* View composers
*
* @see https://docs.wpemerge.com/view/view-composers.html
* ------------------------------------------------------------------------
*/
/*
View::addComposer( 'partials/foo', \App\ViewComposers\FooPartialViewComposer::class );
*/
I believe you are affected by an old bug - please update to the latest versions of everything (wpemerge-theme, wpemerge, wpemerge-blade).
Since the theme is setup using composer create-project the simplest solution would be to re-setup it the same way.
After that, restart your webserver and give it another try. If you still have the same error after doing that please submit your composer.lock so I can double check the versions installed.
PS:
You have a couple of typos - these are not the cause for the problem, but wanted to mention them so they don't muddy the results:
"theme/template/baselayout.blade.php" - template should be templates
@sinegrain commented on Thu Aug 02 2018
Hi guys i'm trying to integrate htmlburger/wpemerge-blade with wp-emerge-theme but cannot getting to work. i installed htmlburger/wpemerge-blade with composer and i added the service provider to config.php
here is my "app/config.php"
Here is my "app/src/controllers/MainController.php"
Here is my view "theme/template/baselayout.blade.php"
Here is myb "app/framework.php"
When i load the page i receive ERR_EMPTY_RESPONSE
I am doing something wrong or i miss a config?
@atanas-angelov-dev commented on Thu Aug 02 2018
Hi @sinegrain ,
I believe you are affected by an old bug - please update to the latest versions of everything (wpemerge-theme, wpemerge, wpemerge-blade). Since the theme is setup using
composer create-project
the simplest solution would be to re-setup it the same way.After that, restart your webserver and give it another try. If you still have the same error after doing that please submit your composer.lock so I can double check the versions installed.
PS: You have a couple of typos - these are not the cause for the problem, but wanted to mention them so they don't muddy the results:
template
should betemplates
@yeld('content')
should be@yield('content')