Search code examples
phpsilverstripesilverstripe-4

SilverStripe 4 custom error page not shown


In my last project on SS 4, I'm trying to create my usual custom error pages - with same approach used on v. 3:

  • Creating ErrorPage.ss inside /themes/mysite/templates/Layout;
  • Including $Content inside template;

After a successful /dev/build?flush=all I don't see any content, neither right template (I see the default Page.ss one instead).

In back-end there are error pages saved and published. In /assets/ there are the static ones too.

Maybe the procedure is changed in this new version? Any advice?

Thanks in advance everyone.


Solution

  • Your ErrorPage.ss folder structure needs to match the core PHP class's namespace (SilverStripe\ErrorPage\ErrorPage), i.e. themes/mytheme/templates/SilverStripe/ErrorPage/Layout/ErrorPage.ss