When using an inline partial viewscript in my form, I sometimes need access to data. I can accomplish this by using a setter and getter with a public function in my form. We’ll use the action “guinness” as the controller action in this example.


protected $_id;

public function setId($id)
    $this->_id = $id;
    return $this;

public function getId()
    return $this->_id;

public function getPintCount()
    $model = new PubModel();
    return $model->countPints(this->getId());




$form = new SomeForm();




This way I can get the content view my connected partials which in essence are a copy of the viewscript.

Seems a long way round, but it keeps everything nicely separated.




By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.