Help with parameters in controller
Try using the $params variable
public function show($params) {
return self::render('views/pregister.php', array(
'id' => $params['id']
));
}
Posted December 10th, 2007 at 4:56am by graaf
Hi Graaf.
At first, thanks for the answer.
The error is still there. Now the undefined variable is $params, and the error message is similar to the above.
Hope you can help me to solve it. TIA
Posted December 14th, 2007 at 4:40am by penyaskito
Ah.. i've found it.
It was already posted on the forum i think.
In classes/PicoraDispatcher.php change on line 79:
from:
$response = call_user_func($callback);
to:
$response = call_user_func($callback, $instance->params);
Posted December 17th, 2007 at 5:13am by graaf
Hi all,
I'm trying to use Picora in an OpenSource project. I have a problem with the parameters on the controller. I have on MyController:
And in the config.php file, I route:
But the id is not being retrieved from the url, the error is:
Warning: Missing argument 1 for MyController::show() in XXX/controllers/MyController.php on line 20
// line 20 is public function show($id)
Notice: Undefined variable: id
Any hint? Thanks is advance.
Posted December 8th, 2007 at 5:51am by penyaskito