Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,我用yaf开发,但目录想自定义下,将视图views的目录改成其他地方? #549

Open
yegaomin opened this issue Jul 27, 2021 · 2 comments

Comments

@yegaomin
Copy link

原来是放在application目录里面,我视图文件放在public目录中,如何把原来配置的目录换到public里面?

@lushaoming
Copy link

我是重写了Controller_Abstract的display方法:
$view = new \Yaf\View\Simple(APPLICATION_PATH . "/logs/views");
return $view->display("{$tpl}.phtml", $parameters);

@Sgenmi
Copy link

Sgenmi commented Sep 13, 2021

可以试试 https://www.php.net/manual/zh/yaf-view-interface.setscriptpath.php
我本地 3.3.2 是有效
在Bootstrap.php 中增加

    public function _initView(Yaf\Dispatcher $dispatcher){
        $dispatcher->initView('')->setScriptPath('/temp/dir');
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants