It does sound weird.
However one way could be:
1. require_once of php file for specified controller in app/controllers, or
use loadController().
2. create instance of controller.
3. For instance in 2, use get_class_methods. Ignore methods starting with _
(they are private to controller).
Something like:
<?php
class AppController extends Controller
{
function _actionExists($controller, $action)
{
$exists = loadController($controller);
if ($exists)
{
$controllerClass = $controller . 'Controller';
if (class_exists($controllerClass))
{
$instance =& new $controllerClass();
$exists = in_array($action,
get_class_methods($instance));
}
}
return $exists;
}
}
?>
Then on your controllers:
<?php
if ($this->_actionExists('Accounts', 'login')
{
// Got it
}
else
{
// Not there!
}
?>
-MI
---------------------------------------------------------------------------
Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.
BAKE ON!
-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de Chris Hartjes
Enviado el: Lunes, 11 de Diciembre de 2006 03:56 p.m.
Para: [email protected]
Asunto: Re: Check an action exists
I'm curious as to why one controller needs to know the actions of another?
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---