I don't know if this can be done automatically just using a single
route. If you want:
http://host/blog/test  => Blog->Index('test')
BUT
http://host/blog/history/2006 => Blog->History('2006')

Then one thing you could do is hand over the routing logic to your
BlogController's index function, by using the following route:

$Route->connect('/blog/*', array('controller'=>'Blog',
'action'=>'index'));

Then, in your index function check to see if the first parameter passed
is a defined action in the controller by using method_exists($this,
<<first parameter>>);, and if it does exist use call_user_method(); to
hand over execution to that action (you'll have to make sure you also
manually set which view to render by calling
$this->render('actionname') in each of your actions. The problem with
this though is it is a security issue since if someone enters
http://host/blog/redirect, since method_exists($this, 'redirect')
exists in AppController, it would execute that function. If you use
some action-based security (like the ACM plugin), then its
functionality is messed up as well.

Alternatively (and probably the easiest way, unless you're going to
have dozens of actions), like AD7 says, you can simply define routes
for all your OTHER actions above where you do the /blog/* catch-all
route, then you get the same desired effect with a lot less hacking.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to