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 [url=http://api.silverstripe.org/2.4/sapphire/control/ContentController.html#methodhttpError]SS Docs[/url], the httpError method can take two arguments:
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?