过载仪表板模板不起作用 - SilverStripe 3.3
Overload dashboard template not working - SilverStripe 3.3
我正在使用 Unclecheese 仪表板模块。现在我正在尝试重载 (? I think that's the right englisch term)
Dashboard_Content.ss 模板。为此,我将其内容复制到模块目录下 "Includes" 文件夹中的同名新文件中。进行更改并保存。
刷新后没有任何反应,但如果我将相同的模板文件放在 mysite/templates/Includes 而不是 mymodule/templates/Includes 下,它会按预期工作......
即使我从仪表板文件夹中删除原始模板文件,我的模块文件夹中的文件也无法识别。
我的下一个尝试是扩展仪表板并使用另一个模板呈现它
<?php
class CSYMDashboardExtension extends DataExtension {
public function init() {
$config = SiteConfig::current_site_config();
if(!$config->CompanyID || !$config->CompanyOwner || !$config->Bank || !$config->IBAN || !$config->BIC || !$config->UstID || !$config->SenderEmail) {
return $this->owner
->customise(
['Message' => 'Die Einrichtung ist noch nicht komplett abgeschlossen! Wird das System in diesem Zustand verwendet werden Fehler auftreten! Bitte setzen Sie die Einrichtung hier fort <a href="/admin/settings/">Einstellungen</a>']
)->renderWith(['DCTest']);
}
}
}
但这不管用,无论模板文件位于何处(我也试过onAfterInit()
。
在我的模块中 config.yml 我声明它在框架和 cms 之后加载 After: 'framework/*','cms/*'
有人解决这个问题吗?
编辑: 作为一个小旁注,我在重载 UploadField_FileButtons.ss 模板时遇到了类似的问题。在我将 "Includes"-文件夹更改为 "includes" 之前,这也没有被识别。但对于仪表板情况,它不是双向工作的。
一个模块模板将难以覆盖另一个模块的模板(如果可能的话......?)
我建议您覆盖特定于主题模块的 <current_theme>_dashboard
文件夹中的模板,并使其结构与您目前所拥有的类似。
所以最后,您的文件将位于:
themes/templates/<current_theme>_dashboard/includes/Dashboard_Content.ss
参考:
https://docs.silverstripe.org/en/3.2/developer_guides/templates/template_inheritance
我正在使用 Unclecheese 仪表板模块。现在我正在尝试重载 (? I think that's the right englisch term)
Dashboard_Content.ss 模板。为此,我将其内容复制到模块目录下 "Includes" 文件夹中的同名新文件中。进行更改并保存。
刷新后没有任何反应,但如果我将相同的模板文件放在 mysite/templates/Includes 而不是 mymodule/templates/Includes 下,它会按预期工作......
即使我从仪表板文件夹中删除原始模板文件,我的模块文件夹中的文件也无法识别。
我的下一个尝试是扩展仪表板并使用另一个模板呈现它
<?php
class CSYMDashboardExtension extends DataExtension {
public function init() {
$config = SiteConfig::current_site_config();
if(!$config->CompanyID || !$config->CompanyOwner || !$config->Bank || !$config->IBAN || !$config->BIC || !$config->UstID || !$config->SenderEmail) {
return $this->owner
->customise(
['Message' => 'Die Einrichtung ist noch nicht komplett abgeschlossen! Wird das System in diesem Zustand verwendet werden Fehler auftreten! Bitte setzen Sie die Einrichtung hier fort <a href="/admin/settings/">Einstellungen</a>']
)->renderWith(['DCTest']);
}
}
}
但这不管用,无论模板文件位于何处(我也试过onAfterInit()
。
在我的模块中 config.yml 我声明它在框架和 cms 之后加载 After: 'framework/*','cms/*'
有人解决这个问题吗?
编辑: 作为一个小旁注,我在重载 UploadField_FileButtons.ss 模板时遇到了类似的问题。在我将 "Includes"-文件夹更改为 "includes" 之前,这也没有被识别。但对于仪表板情况,它不是双向工作的。
一个模块模板将难以覆盖另一个模块的模板(如果可能的话......?)
我建议您覆盖特定于主题模块的 <current_theme>_dashboard
文件夹中的模板,并使其结构与您目前所拥有的类似。
所以最后,您的文件将位于:
themes/templates/<current_theme>_dashboard/includes/Dashboard_Content.ss
参考: https://docs.silverstripe.org/en/3.2/developer_guides/templates/template_inheritance