【问题标题】:Silverstripe 4.2.1 Live site don't detect public namespaced templatesSilverstripe 4.2.1 Live 站点不检测公共命名空间模板
【发布时间】:2018-09-21 08:50:30
【问题描述】:

一切都在我的本地服务器上运行,但是当我将网站上线时,一切正常,除了未检测到通过 $Layout 的命名空间模板,因此只有 2 个主要 Page.ss 的内容页面可见。

你知道我该如何解决吗?

我当然尝试开发/构建、?flush=1、?flush=all 等,但没有任何效果。

这是我的构建结构:

    app
      _config
        **app.yml**
        **theme.yml**
      src
        **HomePage.php**
      templates
        **Page.ss**
        Include
        Layout
          **Page.ss**
        Silverstripe
          fefracaf
            Layout
              **HomePage.ss**

我的命名空间是: 命名空间 SilverStripe\fefracaf;

mysite/app/src/HomePage.php

<?php

namespace SilverStripe\fefracaf;

use Page;

class HomePage extends Page
{

}

mysite/app/_config/app.yml

---
Name: fefracaf
---
SilverStripe\Core\Manifest\ModuleManifest:
  project: app

mysite/app/_config/theme.yml

---
Name: mytheme
---
SilverStripe\View\SSViewer:
  themes:
    - '$public'
    - '$default'

提前感谢您的帮助

【问题讨论】:

    标签: templates namespaces themes silverstripe silverstripe-4


    【解决方案1】:

    可能是您的文件夹名称:Silverstripe。您的 PHP 命名空间是 SilverStripe - 请注意,Linux 系统区分大小写,而 MacOS 等本地环境则不区分。

    【讨论】:

    • @Grafka 你也应该避免在你自己的类中使用 SilverStripe 作为命名空间。您可以使用自己的组织名称作为顶级 ns。
    • 已解决,确实是因为命名空间中的文件夹名称“Silverstripe”。感谢您的帮助!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 2013-03-31
    相关资源
    最近更新 更多