Search code examples
phptemplatessilverstripesilverstripe-4

Silverstripe won't pick up Content.ss file on server but no problem locally


I am building a module for SilverStripe. I am simply extending LeftAndMain.php and showing a template by placing the template file at templates/module/namespace/MyClass_Content.ss

It is working like a charm locally and I can see all the changes I am making to MyClass_Content.ss in my browser. But when I host it on my server, everything else works fine, I can see my navigation item too, but on right side, where content is supposed to be rendered, empty space.

Just to poke around, I navigated into the vendor folder locally and on the server, and I edited the MyClass_Content.ss file by placing a HELLOWORLD on the starting of the file. Locally, I can see the HELLOWORLD disrupting the whole view and the breadcrumbs, but on the server, no change, empty right side.

There are no error logs for nginx or php. The error logs in the console don't seem to be important since I see the same on both local and server. Even the JS and CSS is loading on the server, the only difference in the network panel is the images won't load on the server, which makes sense since the template won't load.

How do I debug this? Any ideas?


Solution

  • Update: Actually, it was the namespace. Namespace was Silverstripe but the template path was SilverStripe. Locally worked due to case-insensitive environment, but failed on prod due to a case-sensitive environment.

    I just checked your repo - move your templates directory up to sit next to src instead of inside it. :)