Hello,
In a controller, is there a way to manipulate the model object then have SilverStripe render that model using the appropriate template?
I can get close to this by overriding handleRequest() in the controller, making whatever changes are desired to the model, then "return $this->renderWith(array("Page"), $this->dataRecord);". The problem with this approach is that the template name must be hard coded. It would be nice if there was a way to say "render this model object using the appropriate template."
-- or --
Is there a way which I can access the current request from the model object?
.
In case you are wondering, I am creating a page type which pulls its content from a remote web application based on the current request's URL. It's easy for the controller do to the fetching, as it has access to the request, but then the controller ends up being hard-coded to render using a certain template. In order to move this functionality to the model (easing the process of template rendering), the model needs access to the current request.
Thank you,
Ben