From: Jason S. <jsw...@ya...> - 2003-01-13 20:48:32
|
Regarding the issue of "forwarding" vs. "redirect", I think the essence of the problem is the "view" creation is outside the scope of the current implementation of Phrame. In the hello example, index.php was essenitally procedural code. I think the next step for Phrame is to bring the generation of the views into the OO framework. Either the ActionController class should be extended, or a new ViewManager class should be created. Your main application file would be: A) if (action) { $controller->process() } else { $viewmanager->display() } or B) if (action) { $controller->process() } $viewmanager->display() this kind of a structure would let you do the forward processing for the action by: under A) creating a viewmanager and calling the appropriate view to display or under B) setting the proper information to allow the viewmanager to display the correct view when it falls our of the controller processing If you went with B, you will want to add the exit statement after the header('Location: ...') line so that your default view will not be processed in the background while your clients browser is directed to the new location. I know this kind of extension will work for rendering obecause(beextended extened the ActionController class to do just this in my current phramapplicationpliation) but I have not thought it out sufficiently to handle multiple output methods (HTML, WAP, XLS, ...). The main sticking point I have is between common data (user identity, navigation) and view specific data. There might need to be some sort of a common $viewmanager->prepare() method, followed by $view->display(); where the $view object would be an application specific version of a generic view class, and one class for each view. Thoughts? Jason --- Ross Keatinge <te...@ya...> wrote: > Hi Arnold > > Sorry I haven't had time to contribute much here. > > --- Arnold Cano <arn...@ya...> wrote: > > Ross is correct that in Struts the REDIRECT flag > > determines whether the system uses the forward() or > > sendRedirect() method. However, since PHP does not > > have an equivalent to the forward() method, Phrame > > uses the header() method in both cases. The only > > difference being that when the REDIRECT flag is in > > place the session information is destroyed before the > > header(). > > I don't recall exactly how forward works in JSP but I think the closest > thing we have in PHP is 'include'. I know it sounds different but I > think the end result is more or less the same. > > Perhaps the ActionView class does something something like: > > include "$path_to_views/$required_view" . '.php'; > > Maybe JSP's forward does something tidy in terms of variable scope. I > don't know. > > > Does anyone know if there is a way to "forward" to > > another page on the server (server side) without using > > the header() method? I may be wrong but my > > understanding is that the header('Location: '.$path) > > method asks the browser to fetch the $page (client > > side). > > Your understanding is correct. > > Ross __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com |