Looks like you are defaulting a value right?
use $this->_getParam('value', 0);
the second param is default if not set
2009/2/14 PHPScriptor <[email protected]>:
>
> Ok, maybe I'm totally wrong but can I do something like this and how:
>
> class MyController extends Zend_Controller_Action
> {
> public $value
>
> public function __construct() {
> if($this->_request->getParam('value'))
> $this->value = $this->_request->getParam('value');
> else
> $this->value = 0;
> }
>
> ...
> }
>
> is this possible? I want to set my $value so that I can use it in all my
> actions (when called). But the value can be a default (0) or it can be
> passed by getParam. Don't know if this is the correct way. Maybe someone can
> help me with this.
>
> when I left out all the thing with getParam I get:
> Fatal error: Call to a member function notifyPreDispatch() on a non-object
> in C:\wamp\php\Zend\Controller\Action.php on line 490
>
> when I do it with the getParam I get:
> Fatal error: Call to a member function getParam() on a non-object in
> C:\wamp\www\app\modules\my\controllers\MyController.php on line 16
>
> -----
> visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/
> --
> View this message in context:
> http://www.nabble.com/OO-getParam-in-__construct-tp22013691p22013691.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>
--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------