[eluser]Krzysiaczek[/eluser]
Hi wiredesignz, great extension.
I'm trying to call module from another place - a view like this:
Code:
<?php $parameter = 5; ?>
...
<?php echo Modules::run('samplemodule/samplemethod', $parameter); ?>
...
<?php echo $parameter;?>
I found that you are using in .../third_party/MX/Modules.php
Code:
call_user_func_array( callback $function , array $param_arr )
Based on info from php.net:
Quote:Referenced variables in param_arr are passed to the function by reference, regardless of whether the function expects the respective parameter to be passed by reference.
The problem is that I'm trying to change $parameter inside the module but when check back again in the view (from place where I've called that) it's not affected by changes inside module. It should be equal 6 but is still equal 5.
Code:
class Samplemodule extends MX_Controller {
function __construct(){
parent::__construct();
}
function samplemethod($param) {
...
$param++;
...
return $output;
}
When try to force passing by reference in module definition it raises the error in MX/Modules
Code:
function samplemethod(&$param) {
Am I missing something?
:-S