0

I have an array in my controller:

$data = array(
          'a' => "Hay",
          'b' => "Bee",
          'c' => "Sea",
);
$this->view->assign($data);

In the view nothing is returned:

<?php echo $this->data['a']; ?>
<?php var_dump($this->data); ?>
2
  • 1
    are you sure that $this->data points to $data ? try to var_dump( $this->data) Commented Aug 28, 2012 at 15:21
  • in your controller change $this->view->assign($data) to $this->view->data = $data; Commented Aug 28, 2012 at 15:24

1 Answer 1

1

try this in controller

$this->view->data = $data;

for better explanation goto Zend Manual

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, this also works, $this->view->assign('data',$data);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.