you can do a command controller, but anyway you should write the list of
commands,

there is a quick example (please correct it is just a guide)

class commandcontroller extends appcontroller{

function index($command = 'error'){
if(function_exist( $this->{$command}()) ){
$this->{$command}()
}else{
$this->error();
}
}

function commandOne(){
}
function commandTwo(){}
function error(){
echo "the command doesnt exist";
}

}

On Tue, Oct 14, 2008 at 6:50 PM, Chez17 <[EMAIL PROTECTED]> wrote:

>
> So I have an ajax chat application that I am working on. If a user
> types a comment the starts with '/' it sends the comment to the
> 'command' function in my controller (as opposed to a normal 'add'
> function for chats). For example if the user types "/help" it will
> list all the possible commands. Now the command function is going to
> have to parse the command and return the proper information. The way I
> did the first couple commands was just a switch statement. But I got
> to thinking if there was a better or more "cake" way to do it. Are
> there better ways then just a giant switch statement? Should I try to
> create my own component? What are your thoughts on this? Any help will
> be greatly appreciated.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to