我试图从我的主题加载一个视图类,但它没有找到错误。我试图从我的主题为Paginator和Form加载自定义配置。主题加载正常,主题工作的所有资源都无法加载视图类。以下是文件列表和相关文件。
主题名称:材料
文件:
bootstrap.php中
Plugin::load('Material');
AppController.php
public function beforeRender(Event $event)
{
$this->viewBuilder()->setTheme('Material');
$this->viewBuilder()->setClassName('Material.Material');
}
MaterialView.php
namespace Material\View;
use Cake\View\View;
class MaterialView extends View
{
public function initialize()
{
parent::initialize();
$this->loadHelper('Paginator', ['templates' => 'paginator-templates']);
$this->loadHelper('Form', ['templates' => 'form-templates']);
}
}
其他信息:
错误消息:查看类" Material.Material"缺少。没有显示文件创建提示。
堆栈追踪:
2017-09-17 15:34:17 Error: [Cake\View\Exception\MissingViewException]
View class "Material.Material" is missing.
Exception Attributes: array (
'class' => 'Material.Material',
)
Request URL: /register
Referer URL: http://localhost/
Stack Trace:
#0 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/View/ViewVarsTrait.php(118): Cake\View\ViewBuilder->build(Array, Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Event\EventManager))
#1 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Controller/Controller.php(622): Cake\Controller\Controller->createView()
#2 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(125): Cake\Controller\Controller->render()
#3 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(93): Cake\Http\ActionDispatcher->_invoke(Object(App\Controller\CryptoUsersController))
#4 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/BaseApplication.php(78): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#5 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#6 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php(59): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#7 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#8 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php(88): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#9 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#10 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php(92): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#11 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#12 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/debug_kit/src/Middleware/DebugKitMiddleware.php(52): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#13 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/Runner.php(65): DebugKit\Middleware\DebugKitMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#14 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#15 /mnt/internal-storage/Web Development/crypto/vendor/cakephp/cakephp/src/Http/Server.php(80): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#16 /mnt/internal-storage/Web Development/crypto/webroot/index.php(37): Cake\Http\Server->run()
#17 {main}
我在这里缺少什么?我觉得这可能是显而易见的,但正好在我的头上。