Silverstripe 3中是否有现成的功能来使所有模板都位于特定的文件夹中,以便将它们放在Arraylist中?如果没有,有人做过吗?我的目标是从下拉列表或单选按钮集中选择模板。还是我应该用...$files = glob("/path/to/directory/*.ss");谢谢。塞普。
1 回答
![?](http://img1.sycdn.imooc.com/5458631e0001ffd402200220-100-100.jpg)
largeQ
TA贡献2039条经验 获得超7个赞
userforms模块执行此操作以显示可能的收件人电子邮件模板的列表。这是相关的部分:
$templates = [];
$finder = new SS_FileFinder();
$finder->setOption('name_regex', '/^.*\.ss$/');
$found = $finder->find(BASE_PATH . '/path/to/directory');
foreach ($found as $key => $value) {
$template = pathinfo($value);
$templates[$template['filename']] = $template['filename'];
}
- 1 回答
- 0 关注
- 134 浏览
添加回答
举报
0/150
提交
取消