htmlburger / wpemerge-theme

An organized, ES6 and SASS powered theme taking advantage of the WP Emerge framework. 🚀
https://wpemerge.com/
GNU General Public License v2.0
286 stars 33 forks source link

WPEmerge\view not working #33

Closed webafra closed 5 years ago

webafra commented 5 years ago

Route::get()->url( '/hello' )->handle( function() { return WPEmerge\view( 'templates/about-us.php' )->withStatus( 200 ); } );

Error : Call to undefined method WPEmerge\View\PhpView::withStatus()

atanas-dev commented 5 years ago

The docs have some misleading examples on this which I will be updating shortly. The problem comes from the missing leading \ so the usage should be like this: \WPEmerge\view( ... ); instead of this: WPEmerge\view( ... );

The second usage works when you are in a file that does not have a namespace definition but controllers usually do so the absolute namespace form has to be used (i.e. the leading \).

atanas-dev commented 5 years ago

All namespaced function usage in the docs has been updated: https://docs.wpemerge.com/#/framework/overview