'Twas brillig, and PHPScriptor at 14/02/09 15:23 did gyre and gimble:
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.

Read the docs some more! You should implement the init() method which gets called after construction.

You can then use the value in all your actions and/or the preDispatch() and postDispatch() methods too.

Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

Reply via email to