Ura
Ura

Reputation: 2283

How to print array elements in view

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); ?>

Upvotes: 0

Views: 1372

Answers (1)

Keval Malde
Keval Malde

Reputation: 439

try this in controller

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

for better explanation goto Zend Manual

Upvotes: 1

Related Questions