我在模块 XYZ 的 Action 类中使用以下代码:
$this->setTemplate("abc.php");
它试图在哪个目录中查找 abc.php?
最佳答案
对应的路径是templates
目录,与编辑actions.class.php
文件的actions
目录并列.
在文件 /path/to/my/module/actions/actions.class.php
中,如果您这样做:
$this->setTemplate("index");
相应的模板文件位于:
/path/to/my/module/templates/indexSuccess.php
当然,这是假设操作成功完成;失败时,处理方式会有所不同,具体取决于您的实现。
另外值得注意的是:
如果您不使用$this->setTemplate($foo)
手动设置模板,则模板名称由约定决定。对于 Action 函数executeHomepage(sfWebRequest $request)
,
模板 homepageSuccess.php
将按照惯例显示(同样,除非您使用 setTemplate
另行指定)。
关于php - 在 Symfony ( PHP ) 中,setTemplate 方法的路径是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5875851/