What is best practice to imlement Web Controls with callbacks?
I want that controls will be accessible in controllers and in views.

Example:

IndexController.php

class IndexController extends extends Zend_Controller_Action
{
  function indexAction()
  {
     $this->myCoolControl1 = new My_WebControls_CoolControl();
     $this->mySuperCoolControl1 = new My_WebControls_SuperCoolControl();

     $this->myCoolControl1->param1 = 'someParam';
     $this->myCoolControl1->onClick = array($this,
'_myCoolControl1OnClick');
     $this->myCoolControl1->prepare(); // or init() or ???

     $this->view->myCoolControl1 = $myCoolControl1;
     $this->view->mySuperCoolControl1 = $mySuperCoolControl1;
  }

  protected function _myCoolControl1OnClick() // may be with params?
  {
     $this->mySuperCoolControl1->text = 'Clicked!';
  }
}

index.phtml

<?= $this->myCoolControl1 ?>
<?= $this->mySuperCoolControl1 ?>
-- 
View this message in context: 
http://www.nabble.com/What-is-best-practice-to-imlement-Web-Controls--tp21232254p21232254.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to