|
From: Talk21 <jos...@ta...> - 2004-01-30 20:31:50
|
Alex,
Many thanks for your response. I did exactly what you suggested, overrode
_processForward() and did an include rather than rewriting the header, this
works well and was very simple to implement. I also went one step further
and overrode ActionController.process() and moved into it the default action
functionality that Jason Sweat showed in his article 'Industrial Strength
MVC' . I am also currently working on authorisation/login functionality
inside process() as well:
function process($mappings, $request) {
// Check login
if (!array_key_exists(_USER, $_SESSION)) {
$request[_ACTION] = 'login';
}
// Otherwise perform default action
if (!array_key_exists(_ACTION, $request)) {
$request[_ACTION] = 'default';
}
parent::process($mappings, $request);
}
Finally I have already downloaded your Phrame 2.1 examples and will look at
them, especially tphp.
Many thanks,
Joss
-----Original Message-----
From: Alex [mailto:ale...@ya...]
Sent: 30 January 2004 18:44
To: jos...@ta...; phr...@li...
Subject: Re: [Phrame-devel] Extending ActionController
Hi Joss,
Phrame 2.0 implemented the views with http-redirects/forwards.
With 2.1 I've tried to change this behaviour to use java-like
request-dispatchers,
which don't do http-redirects anymore. (atleast, not by default)
For backwards compatibility though, I've retained the redirect behaviour
with 2.1 as
default. This is however only with the default controller!
I've released a few add-ons that might help you here.
Check this url for packages and examples:
http://www.geocities.com/alex_has_email/phrame-2_1_pre/
Most of interest to you will be the dispatching controller, I've added a
demonstration
requestdispatcher implementation for a thing I called tphp, which
basically does a php
include. I've added request/session state, but that's it.
Just look at the example package and you'll see the difference.
If you want to do it yourself, you should be able to subclass the
controller and
reimplement the _processForward. The original method is quite simple, so
just look at
the original code to see how it works. You should have your idea running
quite quickly
I imagine. I'd look at the posted url first though.
I hope this answers the questions you have.
Kind regards,
Alex
jos...@ta... wrote:
Firstly my apologies for posting to the developers list but it seems
have a little more activity than the users list and I'd rather not email
this question to some of the learned individuals on this list without their
permission first.
I develop mainly in Struts and especially Tiles and have just started
using PHP. I have hunted around for a PHP alternative to Struts and I think
I have settled on Phrame for it's simplicity and stability.
However rather than using Smarty or XSLT I would like to contain my
webapp in a single index.php page with includes rather than forwards,
similar in design to the tutorial on Zend 'How Not To Use A Template System'
(http://www.zend.com/zend/tut/tutorial-Darrell.php). The problem I have to
create the controller in the index.php which then forwards to the index.php,
creating a recursive loop. So I suggest extending the ApplicationController
with MyController and override the _processForward() function with one that
performs an include rather than a forward.
This seems to me the simplest approach but would it give me what is
required. For example will I be able to access session variables correctly?
Any comments would be most welcome.
Regards,
Joss Wright
--------------------
talk21 your FREE portable and private address on the net at
http://www.talk21.com
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Phrame-devel mailing list
Phr...@li...
https://lists.sourceforge.net/lists/listinfo/phrame-devel
----------------------------------------------------------------------------
--
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
|