Administrators Nabeel Posted October 15, 2009 Administrators Report Share Posted October 15, 2009 Modules have been overhauled, a-la CakePHP-esque style controllers. For instance, in the past there needed to be a router inside the "Controller" function: For instance, the URL index.php/mymodule/doaction Previously, the code for this would be: <?php class MyModule { public function Controller() { switch($this->get->page) { case 'doaction': .... break; } } } ?> Has now been simplified to: <?php class MyModule { public function index() { } public function doaction() { ... } } With the index() function replacing the Controller() function, and then the doaction() function acting as the action. From now on, the parameter after the module name, will be the function that's called inside the module. index.php/test/callingme <?php class test { public function callingme() { ... } } This simplifies debugging. In addition, parameters can more easily be passed: index.php/test/callingme/apples/oranges <?php class test { public function callingme($parameter1='', $parameter2='') { echo "{$parameter1} and {$parameter2}"; // Will echo "apples and oranges" } } These changes will be made available from the next version. The native modules have been updated to use this new code. Modules will have to be updated to use this code as well Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.