On Tuesday 14 July 2009 08:29:43 Sam Davey wrote: (...)
> The articles suggest that its fine to allow read access to models from the > View via the ViewHelper. So basically all I need to do is grab the date > from the URL and send it to the Model via the ViewHelper. I can then spit > out the results. > > And thats the problem... how do I access the date from the URL? How do I > get the request object? I needed the Router object in the view on some of my projects (for generating the cache token) and the Request object (for setting the ID on the <body/> for easy styling of different site parts) and the easiest way is to create a ViewHelper which accesses the data for you (say, $this->getRouter()- >getCurrentRouteName()). You'll find those ViewHelpers inside the Zym framework IIRC. This is a better approach because you can (if you ever choose to) use different set of view helpers for testing with mock objects returned. -- Dado
