Silverstripe $Layout works on localhost but doesn't on hosting

Silverstripe Version: 4.5

Question:

I’ve been working on a website on my localhost using MAMP and everything seems to work as intended, but when I upload my file to my hosting server it doesn’t get the $Layout variable. It loads the includes and everything else perfectly.

So I’m wondering if it had anything to do with the way I’ve setup my PHP files or if it’s an issue to do with the database.

Please excuse me if it isn’t enough information, I would gladly share my code, but since I don’t know what part of it is causing it I can’t. If you have any idea let me know, thank you very much

Hi yev, welcome to the community!

I’m wondering whether this has to do with the naming of your template files - if your localhost is running macOS, but your hosting server is running Linux, you might see some inconsistent behaviour with capitalisation of filenames. For example, if your page layout file is called ‘page.ss’, when Silverstripe tries to fetch Page.ss, this will work on macOS but not Linux, due to the different ways they treat case sensitivity.

3 Likes

Hi cheddam, Thank you very much for the answer!

Your answer did solve the issue, the folder I were my template/namespace was located was called “silverstripe” instead of “SilverStripe”. Now it seems to work correctly after a quick dev/build.

Thank you very much for the prompt answer and the help, you are awesome!

1 Like