For a SilverStripe website we're currently working on, we've been making use of the "httpError" method for redirecting users to the 404 page when e.g. a DataObject cannot be found on a certain page. Everything is set up properly; there is an instance of ErrorPage in the Site Tree, I've added an ErrorPage.ss file to the Layout directory of our theme and it is being displayed properly whenever it is supposed to. There's just one thing that has us stumped.
According to the SS Docs, the httpError method can take two arguments:
We're assuming that $message is for sending a custom message along to the ErrorPage template. But we can't figure out how to display this message and I haven't had any luck searching the forum, the Docs and Google looking for an example.
void httpError( $code, [ $message = null])
The reason why we want to do this, is because that way we can use the same template but display a different (sub-)message depending on what the user was trying to access. For example:
return $this->httpError(404, 'Sorry, the portfolio item you are looking for could not be found.');
return $this->httpError(404, 'Sorry, the member you are looking for does not exist.');
Is the reason that I can't seem to display the message in the template because it is only for logging purposes maybe?