【问题标题】:setTemplatePath within plugin in Cakephp3Cakephp3插件中的setTemplatePath
【发布时间】:2018-09-29 21:56:40
【问题描述】:

如何设置视图相对于插件的模板路径?这就是我想要做的:

$view = new View();
$view->setLayout('Kuroi/EvzDuser.email'); // <-- this works
$view->setTemplatePath('Kuroi/EvzDuser.Plugin'); // <-- this doesn't work!!!
$view->set('html',$html);
$view->set('lang',$this->lang);
$layout=$view->render('email_register');

CakePhp 正在错误目录中查找我的模板文件 (email_register.ctp):

确认您已创建文件: “Kuroi/EvzDuser.Plugin/email_register.ctp”在以下之一 路径:

/Applications/AMPPS/www/eventspritz.com/evz_2019/src/Template/Kuroi/EvzDuser.Plugin/email_register.ctp

我的模板文件(email_register.ctp)在以下目录中:

/Applications/AMPPS/www/eventspritz.com/evz_2019/plugins/Kuroi/EvzDuser/src/Template/Plugin

【问题讨论】:

    标签: cakephp plugins cakephp-3.0


    【解决方案1】:

    好的,抱歉,我找到了解决方案。对于任何有兴趣的人:

    $view = new View();
    $view->setLayout('Kuroi/EvzDuser.email');
    $view->setTemplatePath('Plugin');
    $view->set('html',$html);
    $view->set('lang',$this->lang);
    $layout=$view->render('Kuroi/EvzDuser.email_register');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-09
      • 1970-01-01
      • 2015-08-20
      相关资源
      最近更新 更多