Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-17 Thread ORCC
Set the "name" attribute into the CommandParser class (If your are using PHP 4 the name attribute is mandatory as it is in models and controllers). class CommandParserComponent extends Object { var $name = "CommandParser"; //the rest of the code. } --~--~-~--~~---

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-15 Thread Chez17
To specify, here is the error: Fatal error: Class 'CommandParser' not found in /home/dave/www/ goontastic/app/controllers/channels_controller.php on line 61 So it's not seeing the 'class' but I am including it in the components array. This for 1.2 RC3. On Oct 15, 3:04 pm, Chez17 <[EMAIL PROTECT

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-15 Thread Chez17
I am having some issues getting what you said to work. It must be a syntactical problem, I can't get something like CommandParser::processCommand() to return anything. Here is the code: /controllers/components/command_parser.php /controllers/channels_controller.php var $components = array('R

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-15 Thread ORCC
> if(function_exist( $this->{$command}()) ){ For testing the existence of cass methods, you should use method_exists instead. if (method_exists(get_class($this),$command) { //blah blah } With this fix i think that this idea would work too, --~--~-~--~~~---~--~

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-14 Thread Chez17
Thanks! This is amazing advice. I am such a beginner and this was fantastic. The array idea is so simple and brilliant, way easier. I will try to look into doing what you suggest. Thanks again. On Oct 14, 9:01 pm, ORCC <[EMAIL PROTECTED]> wrote: > I think first that all you have to separate the "

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-14 Thread Manolet Gmail
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{

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-14 Thread ORCC
I think first that all you have to separate the "parsing" of the text and the execution of the command itself via components, namely: 1) Create a "CommandParser" component that has function to "parse" a command. 2) Create a "CommandExecutive" component that has a method for implement each of the

Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-14 Thread Chez17
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. No