Re: Route instead of redirect?

2009-06-11 Thread Travis L

Have you tried using App::import('Controller', 'ControllerName') to
get an instance of a new controller?  You'd then have to initialize it
with the bootstrap stuff that Cake automatically does for you
(assuming you want the object attributes set correctly).  From there I
would guess that you could make any calls that you want.

However, I'd caution against doing something like this.  Personally
(and, I think conventionally), a URL/URI should represent a resource
(let's say a web page for this example).  The same URI should always
access the same resource (although, I grant you, it'll change over
time if it's DB driven).  If you're not sending redirects, you're kind
of breaking this model.  So make sure this is something you really
want to do before you do it.

Why do you not like redirects, anyway?

On Jun 10, 9:31 am, TimG  wrote:
> Did I stump the experts?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Route instead of redirect?

2009-06-10 Thread TimG

Did I stump the experts?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Route instead of redirect?

2009-06-10 Thread TimG

Update: So I found and tried to use setAction but as expected it only
works from inside a controller. I really need to just load a
controller and action like the error class does or the dispatcher
does. What code would I use to do that from an app_error file?

I tried variations of:

$this->controller =& new Controller();
$this->_set(array('name' => 'listings', 'viewPath' => 'view'));

but it was a complete failure.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Route instead of redirect?

2009-06-09 Thread TimG

To clarify a bit: I know how to redirect and I know how to use routes.
What I need to know is hot to invoke a route from within a controller
or other file - like you do with redirect. I can't find anything in
the docs on how to do that. Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Route instead of redirect?

2009-06-09 Thread TimG

I would like to route instead of redirecting from inside my
app_error.php file. So instead of just redirecting and having the URL
change I would like to keep the URL the same and just have it load a
specified controller and action. Is that possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---